Declaring early bound MSXML object throws an error in VBA

user1486889 picture user1486889 · Jun 28, 2012 · Viewed 68.3k times · Source

I am trying to import xml data into excel.. So the first line of the code is

Dim XMLDOC As MSXML2.DOMDocument

and this gives an error "user defined type not defined"

Answer

Scott Holtzman picture Scott Holtzman · Jun 28, 2012

Inside the VBE, Go to Tools -> References, then Select Microsoft XML, v6.0 (or whatever your latest is. This will give you access to the XML Object Library.

Updated with fancy pic!

enter image description here