Created
February 25, 2020 13:03
-
-
Save sudiptamondal/8514ceb8ce44bfcd8690145125b833d5 to your computer and use it in GitHub Desktop.
Code Snippet to send GET Request via function in Excel Macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
.Send | |
While objRequest.readyState <> 4 | |
DoEvents | |
Wend | |
strResponse = .ResponseText | |
End With | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment