Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Code Snippet to send GET Request via function in Excel Macro
Private Sub FetchData()
Dim objRequest As Object, strUrl As String, blnAsync As Boolean, strResponse As String
Dim jsonObject As Object, item As Variant
Set objRequest = CreateObject("MSXML2.XMLHTTP")
strUrl = "<URL_GOES_HERE>"
blnAsync = True
With objRequest
.Open "GET", strUrl, blnAsync
.setRequestHeader "Content-Type", "application/json"
While objRequest.readyState <> 4
strResponse = .ResponseText
End With
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment