Declaring early bound MSXML object throws an error in VBA
问题 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" 回答1: 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! 回答2: I had DOMDocument defined which needed Microsoft XML, v3.0 but I had Microsoft XML, v6.0 selected in references which caused the below error