Hello,
I have the following variable setup in the global variables:
xmlNode : Automation 'Microsoft XML, v6.0'.IXMLDOMNode
I have a report that is run that executes code in a codeunit and it works perfectly.
Here is part of the code that is in question:
CLEAR(xmlNode);
xmlNode := xmlNodeList.item(i - 1);
The above code runs from the report executing the codeunit with no errors.
I am trying to run this exact same process in a new codeunit that executes the exact same codeunit as used the report does. I copied over all the code and variables to this new codeunit. This new codeunit does exactly the same thing as the report.
When I run the new codeunit, I get the following error:
"This Automation variable has not been instantiated"
When I run the debugger, the error occurs at this line:
xmlNode := xmlNodeList.item(i - 1);
If I try to do a CREATE on xmlNode (which I read you can't do) I get the error "Cannot create an instance of the OLE or automation server", blah blah blah. I understand that this automation cannot be initialized this way.
My question is how do I make this work when executing from a codeunit and not a report? I have checked the code over and over again and have verified that the codeunit matches with the report.
I am using Dynamics NAV 2009 R2 client with the same version for the database.
Any help would be greatly appreciated.
Thank you,
Kris
0
Comments