I am supporting CandidateX

CandidateX is a startup that focuses on creating inclusion-focused hiring solutions, designed to increase access to job opportunities for underestimated talent. Check them out if you have a few minutes to spare. They need visibility!

When you access websites through the browser, caching speeds perceived access since it only actually downloads data for pages and images that seem to have been modified since the last time you accessed them. There is actually caching happening all over the internet between you and the site you are accessing, so occasionally something goes wrong – you don’t get the latest version of the data you are accessing.

 In How to update modules automatically in VBA, data is retrieved using the xmlHTTP object, and sometimes it does not recognize that data has been updated, and returns the cached version. Here’s how gistThat gets over this problem, ( a solution that can be applied to any case you suspect as not refreshing web caches correctly). 

URL parameters

Although there are http headers you can tweak to indicate that the response should not come from cache, they seem not to work reliably. Instead – here’s a way to use a bogus and random parameter in your URL so that it looks like a different URL to the you previously accessed, thereby forcing the response to be freshly downloaded. Just pass your URL to this function, and use the modified one returned by this function instead.

Private Function gtPreventCaching(url As String) As String
' this will tweak the url with an extra random parameter to prevent any accidental caching
Dim p As String
   If (InStr(1, url, "?") > 0) Then
     p = "&"
     p = "?"
   End If
 gtPreventCaching = url & p & "gtPreventCaching=" & CStr(Rnd())
End Function

For more tips like this see Get Started Snippets.  

In the meantime why not join our forum, follow the blog or follow me on twitter to ensure you get updates when they are available.