I have Word VBA code that is supposed to create an Msxml2.DOMDocument object and load an Xml file into it:
Set XDoc = CreateObject("MSXML2.DOMDocument")
XDoc.async = False: XDoc.validateOnParse = False
XDoc.Load (XmlFileName)
This code runs on my computer.
On a coworker's computer the Load method returns False and doesn't load the data.
I tried switching from MSXML 3.0 to MSXML 6.0 by changing the first line of code to
Set XDoc = CreateObject("MSXML2.DOMDocument60")
as well as changing the project's reference to v6.0. This resulted in failure to create the object, giving the error message
"Runtime error 429: ActiveX component can't create object"
I tried reregistering the .dll files for both MSXML versions, with no effect.
What might be causing the code to run on my machine but not on others?
How might I resolve the respective errors for either v3.0 or v6.0?
I figured out what was causing this problem. The XML file I was trying to load was inside a zip file and before loading it I had to find its name using pattern matching. My coworkers computer had the "File name extensions" checkbox unchecked so the file name that VBA read didn't match the required pattern that included the .xml extension. After I checked the checkbox it worked perfectly.