MSXML2.XMLHTTP60.send works on one computer, but not the one it has to work on

Myth

New Member
Joined
Oct 4, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi

A slightly different problem for you. This function works on my laptop, both at home and on the corporate network. On the desktop (corporate network) however it fails at .send. When I test the url in chrome, it retrieves the data. Any suggestions as to how our IT dept have achieved this? (as brilliant as they are, they are not familiar with VBA and don't know what to do on their side to allow it to work). Any help with this would be much appreciated. Thank you

VBA Code:
Function GetAPI(Credent As String, APIurl As String) As Variant
' Credent is the API username and pwd in base64

' IT have restricted use of the MSXML2.ServerXMLHTTP60 inside their network
' Have replaced this with the standard version (they assure me caching is not a problem)

'    This works at home, not on the VPN nor in the office
'    Dim AcousticReQuest As MSXML2.ServerXMLHTTP60
'    Set AcousticReQuest = New ServerXMLHTTP60
    
'' this works in the office on the laptop, but not on the desktop
    Dim AcousticReQuest As MSXML2.XMLHTTP60
    Set AcousticReQuest = New XMLHTTP60
    
' getting the API
' to prevent caching add a time variable to the URL sush as [ "&cb=" timer()*100 ]
' this should prevent caching from interfering with the refresh

    APIurl = APIurl & "&cb=" & Timer() * 100

    With AcousticReQuest
        .Open "GET", APIurl, False
        .setRequestHeader "Accept", "text/json"
        .setRequestHeader "Content-Type", "application/json"
        .setRequestHeader "Authorization", "Basic " & Credent
        .send
        GetAPI = .responseText
        OutPutWS.Cells(1, 1) = .responseText
        OutPutWS.Cells(1, 2) = Len(.responseText)
        
        .abort
    End With

End Function
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
In case your problem hasn't been solved yet, take a look over here...

 
Upvote 0

Forum statistics

Threads
1,214,926
Messages
6,122,306
Members
449,079
Latest member
juggernaut24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top