I'm importing data using API servers into VBA. I use the JsonConverter library from Github.
Due to the process I'm doing data changes and I have to get the data again, unfortunately if I run the Get command a second time, the data is not overwritten and my old data will be shown.
I'm thinking I have to erase the contents from the Object variable but I have not been succesful, how do I handle this
The following is the routine I use to get my data from the API server.
If I print Response after the first run and Then after the second run (where the data has changed) both texts will be the same)
How can I release the contents of Response and testData
Thanks
Due to the process I'm doing data changes and I have to get the data again, unfortunately if I run the Get command a second time, the data is not overwritten and my old data will be shown.
I'm thinking I have to erase the contents from the Object variable but I have not been succesful, how do I handle this
The following is the routine I use to get my data from the API server.
VBA Code:
Dim testData As Object
Dim hReq as Object
Dim testData as object
Dim Response as String
strUrl = "[URL]https://myurl.com/gb/backend/api/v2/testdata[/URL]"
Set hReq = CreateObject("MSXML2.XMLHTTP")
With hReq
.Open "GET", strUrl, False
.setRequestHeader "Authorization", "Bearer " & Key")
.send
End With
Response = hReq.responseText
Set testData = JsonConverter.ParseJson(Response)
If I print Response after the first run and Then after the second run (where the data has changed) both texts will be the same)
How can I release the contents of Response and testData
Thanks
Last edited by a moderator: