How do I initialize an IXMLDOMNode in VBA?

6.2k views Asked by At

When I use the this code in an Excel VBA macro:

Dim xmlKnoten As New IXMLDOMNode

I always get an error. How do I initiate it right?

The initiation of an DOMDocument works:

Dim xmlDoc As Object
Set xmlDoc = CreateObject("Msxml2.DOMDocument")

Thanks for helping.

1

There are 1 answers

0
ARich On BEST ANSWER

First, ensure you have the Microsoft XML reference enabled (my version is v3.0). Once you have that enabled, your code should work, but if it doesn't you can write it like this:

Dim xmlKnoten As New MSXML2.IXMLDOMNode

Hope that helps.