I have some code which calls a function to retrieve a webpage source as a string
call
Function
All is ok when this is first run but when the website updates my code doesn't. The site updates approx every 20 seconds for 10 minutes. I can see the webpage update in a seperate browser but the vba code acts as if the original call to the webpage has been cached. If I stop the vba shut down excel and restart it then picks up latest data but doesn't refresh again.....?
Is there something obvious I'm missing here and is there a way to force the web request to retrieve latest data?
call
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If raceURL2 <> "" Then
liveshowoutput = ExecuteWebRequest(raceURL2)
resultArray = Split(liveshowoutput, "HORSE_NAME -->")
End Sub
Function
Code:
Public Function ExecuteWebRequest(url As String) As String
Dim oXHTTP As Object
Set oXHTTP = CreateObject("MSXML2.XMLHTTP")
oXHTTP.Open "GET", url, False
oXHTTP.send
ExecuteWebRequest = oXHTTP.responseText
Set oXHTTP = Nothing
'Debug.Print (ExecuteWebRequest)
End Function
All is ok when this is first run but when the website updates my code doesn't. The site updates approx every 20 seconds for 10 minutes. I can see the webpage update in a seperate browser but the vba code acts as if the original call to the webpage has been cached. If I stop the vba shut down excel and restart it then picks up latest data but doesn't refresh again.....?
Is there something obvious I'm missing here and is there a way to force the web request to retrieve latest data?