Msxml2.ServerXMLHTTP.6.0 & MSXML2.DOMDocument60 won't work on a particular Excel 2013 version

Viewed 37

I am using the below code to execute an API request from my macro in MS Excel 2016 -

Dim objRequest As Object
Set objRequest = CreateObject("Msxml2.ServerXMLHTTP.6.0") 'nothing happens after this
   
With objRequest
    .Open "GET", "somewebpage", True
    .setRequestHeader "Cache-Control", "no-cache"
    .setRequestHeader "Pragma", "no-cache"
    .Send
    While objRequest.readyState <> 4
        DoEvents
    Wend
    Debug.Print .responseText
End With
Set objRequest = Nothing

When I run this code on my PC, it runs perfectly, but when my client tries to open it, it failed with no errors thrown. I tried adding checkpoints after each step, and just after the CreateObject command, it stops and does nothing. Which I think means the Msxml2.ServerXMLHTTP.6.0 is not supported in my client's PC? Same is happening in one of my other Modules which has a MSXML2.DOMDocument60 object (which I am using to convert JSON string to xml string).

Both of the objects work perfectly in my PC and my other clients' PC (having Excel 2007/2010/2013/2016). But there's this particular excel version which is showing problems. Here are the excel specifications of my PC & my client's PC on which the file isn't working -

  • My PC - Windows 10, Excel 2013 (15.0.4420.1017) MSO (15.0.4420.1017) 32-bit
  • My Client's PC - Windows 7, Excel 2013 (15.0.4569.1504) MSO (15.0.4569.1506) 32-bit

Also here are the References I am using in my .xlsm file -

What could be wrong? Does the excel version on my client's PC not support Msxml2.ServerXMLHTTP.6.0 & MSXML2.DOMDocument60? Kindly guide... Thanks! :)


Edit : Does this have something to do with the MS XML reference being v6.0? Will this error be resolved if it was MS XML v3.0? If yes, what if I all-together changed the reference from v6.0 to v3.0? Will it still work on the devices it used to? Kindly guide...

0 Answers
Related