VBA Add-In in MS Excel using a URL containing XML calling on Internet Explorer.

Delli gatti, Joseph 1 Reputation point
2022-07-21T18:57:22.9+00:00

I got a new laptop, and now my custom VBA add-in doesn't work. I updated the new laptop; so, I think they've got to be using the same software and OS versions now. The only difference is that my old laptop used to have Internet Explorer on it (which was removed by IT several months ago). After IE removal, the add-in continued to function. But it's not working on the new laptop even after updates.

The VBA code produces a URL containing XML elements that are sent to the USPS Website.
The USPS Website provides back a page containing a response - also in XML format.
The VBA finds the appropriate XML tag and imports the result to a cell in my document.

The core to the VBA code is as follows:

    Set ie = CreateObject("InternetExplorer.Application")  
    ie.navigate URLAll  
While ie.ReadyState <> 4  
    DoEvents  
Wend  

Set ieDoc = ie.document  
ReturnData = ieDoc.activeElement.innerText  
iCnt = Len(ReturnData)  

At this point, the VBA runs and appears to send the request correctly to Edge. But then, Edge returns the following error:

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Number>80040B19</Number>
<Description>XML Syntax Error: Please check the XML request to see if it can be parsed.(B)</Description>
<Source>USPSCOM::DoAuth</Source>
</Error>

I have validated the syntax of the URL.

http://production.shippingapis.com/ShippingAPI.dll?API=Verify&XML=  
<AddressValidateRequest USERID="My ID removed for security">  
<Address ID="0">  
<Address1>3474 S. 2300 E.</Address1>  
<Address2></Address2>  
<City>Salt Lake City</City>  
<State>UT</State>  
<Zip5></Zip5>  
<Zip4></Zip4>  
</Address>  
</AddressValidateRequest>  
Microsoft 365 and Office Development Other
Microsoft Edge Microsoft Edge development
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.