Function VbScript:函数未完全执行

Function VbScript:函数未完全执行,function,vbscript,Function,Vbscript,我正在尝试调用一个函数。在函数中,我读取一个xml文件,并将值更改为其中一个节点。但它在sXmlFile=OpenXMLFile(“\\common\u automation\common\u bin\”&sXmlFileName&“.xml”)行之后退出函数。 单独测试时,函数内部的功能运行良好。但是我如何使控件进入整个函数而不退出。在为第一次调用完全执行函数中的语句之前,它将执行对函数的第二次调用 x=replace_instrument_id(strIp,"newFund") y=repl

我正在尝试调用一个函数。在函数中,我读取一个xml文件,并将值更改为其中一个节点。但它在
sXmlFile=OpenXMLFile(“\\common\u automation\common\u bin\”&sXmlFileName&“.xml”)行之后退出函数。

单独测试时,函数内部的功能运行良好。但是我如何使控件进入整个函数而不退出。在为第一次调用完全执行函数中的语句之前,它将执行对函数的第二次调用

x=replace_instrument_id(strIp,"newFund")
y=replace_instrument_id(strIp,"newBlock")
z=replace_instrument_id(strIp,"newSecRef")

Function replace_instrument_id(sCusip,sXmlFileName)
WScript.Echo"sCusip:" & sCusip
WScript.Echo"sXmlFileName:" & sXmlFileName
sXmlFile = OpenXMLFile("\\common_automation\common_bin\" & sXmlFileName & ".xml")
WScript.Echo "sXmlFile" & sXmlFile
strCusip = sCusip

Dim sNS    : sNS      = "xmlns:xs='http://www.w3.org/2001/XMLSchema'  xmlns:msdata='urn:schemas-microsoft-com:xml-msdata'"
Dim oXDoc  : Set oXDoc = CreateObject( "Msxml2.DOMDocument.6.0" )
Dim sXPath 

if(sXmlFileName="newSecRef") Then
   sXPath    = "/NewDataSet/ReturningDataSet/live_ins_id"
Else
   sXPath    = "/NewDataSet/ReturningDataSet/ins_id"
End If
  oXDoc.setProperty "SelectionLanguage", "XPath"
  oXDoc.setProperty "SelectionNamespaces", sNS
  oXDoc.async = False
  oXDoc.loadXml  sXmlFile

   If 0 = oXDoc.ParseError Then
     oXDoc.selectSingleNode(sXPath).text = strCusip
     oXDoc.save "\common_automation\common_bin\"& sXmlFileName &".xml"
     WScript.Echo oXDoc.selectSingleNode(sXPath).text
  Else
    WScript.Echo oXDoc.parseError.reason
  End If
End Function

Function OpenXMLFile (filename)
    Set objFSO = CreateObject("Scripting.FileSystemObject") 
    Set objFile = objFSO.OpenTextFile(filename, 1) 
    thisline = objFile.ReadAll
    objFile.Close
    OpenXMLFile = thisline
End Function
我得到的结果是

sCusip:02R99BET7
sXmlFileName:newFund
sCusip:02R99BET7
sXmlFileName:newBlock
sCusip:02R99BET7
sXmlFileName:newSecRef

OpenXMLFile()来自哪里?它应该做什么?你能显示这个函数的代码吗?用OpenXmlFile更新了代码。这个函数应该做什么?您是否有“下一步错误恢复”活动?