• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

vb script xmldom

The following code fails on Line 22 where I am returning the loaded xml document back to the operational code.  Is this a limiation of vb script, not being able to pass an xmldom object back from a function?  If not a limitaition of vb script, how do I code so xml doc is returned and able to be parsed in the operational code?

Other info:  This is used in a proprietary work flow designer for an ERP system.  
The scripting window in the work flow designer is vb script based.
dim template
set template = CreateObject("Microsoft.XMLDOM")

template = RetrieveTemplate
msgbox template

Function RetrieveTemplate()

	dim xmltemplate
	set xmltemplate = CreateObject("Microsoft.XMLDOM")
	xmltemplate.async = false

	file = "http://training7i/ifas7/workflow/custom/POPRRCFM/xml/seedrequestPOUPPR.xml"
	xmltemplate.load file
	msgbox xmltemplate.xml  'this works ok
	RetrieveTemplate = xmltemplate  'this fails

End Function

Open in new window

1 Solution
xmltemplate is an object, so you need the keyword Set before the "receiver" - line 21:
Set RetrieveTemplate = xmltemplate  'this fails

the same goes for line 5.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now