Reputation: 597
I use Microsoft XML v3.0 reference in VBA to retrieve information from an XML file (API). But sometimes I get the following error: 'user defined type not defined'. When I change the reference to Microsoft XML v6.0, the problem is fixed. But, sometimes, I also get the same error using 6.0. If I switch back to 3.0, the problem is fixed again. So I have to keep changing references in order to avoid the error. Since this file is being used by multiple people, it is impractical to keep switching references. Excel 2013 and 2016 are used to open this file. Once again, I don't always get the error, but sometimes. I really don't know what to do.
Can someone help me out?
Part of code:
Public Function Search(sSearchID As String)
Dim sURL As String
Dim sEnv As String
Dim xmlhtp As New MSXML2.ServerXMLHTTP
Dim XMLDoc As New DOMDocument
Dim xmlDocSend As New DOMDocument
Dim xmlDocResponse As DOMDocument
Dim xmlCompanies As IXMLDOMNodeList
Dim xmlCompany As IXMLDOMNode
Dim xmlDataItem As IXMLDOMNode
Dim xmlDataItems As IXMLDOMNodeList
Dim xmlAddressItems As IXMLDOMNodeList
[...]
Upvotes: 2
Views: 2880
Reputation: 19
Changing VBA plugin version works for me:
Upvotes: 2