I have a simple XML file that has the current version number of my VBA application. Upon initialization of the application, I call the GetCurrentVersionNumber()
function to fetch that version number. Problem is, when I change the XML file on the server, VBA doesn't recognize it. It appears to be reading a cached version of the XML file.
Is there a way in VBA to prevent the XML file being loaded from being cached? Or, is there another workaround to this?
Here is the function:
Function GetCurrentVersionNumber() As String
Dim doc As MSXML2.DOMDocument60
Set doc = New MSXML2.DOMDocument60
doc.async = False
If Not doc.Load("http://mywebsite.com/myfile.xml") Then
Debug.Print "Unable to retrieve current application version."
GetCurrentVersionNumber = ""
Exit Function
End If
GetCurrentVersionNumber = doc.SelectSingleNode("/Application/Version").Text
End Function
If I go to my default browser (Chrome), navigate to the the XML file, and press Shift+F5 to force reload, the VBA application gets updated thereafter.