Skip to content Skip to sidebar Skip to footer

Getting The Readystate Of An Xmlhttprequest From Javascript In Vba

I have an Excel file that we keep for things we find around my job. We have to log into a website in order to check certain things. With VBA, I've gotten an IE window to open, I ge

Solution 1:

Use a ready waiting loop.

You will need the WinAPI sleep function:

PublicDeclareSub Sleep Lib"kernel32" (ByVal dwMilliseconds AsLong) 'For use in timer function

Then, after your request is sent you need to do something like (example for an IE object, if you update your Q with your code I can modify for your needs).

Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://google.com"DoWhileNot IE.readyState = 4
    Sleep 250Loop

What this does is sleep for 1/4 of a second, looping until the document has loaded.

Post a Comment for "Getting The Readystate Of An Xmlhttprequest From Javascript In Vba"