Hello cadkins,
Welcome to the forum!
The problem has to with timing. While stepping through the code, more time passes allowing for the web page to load. You're probably saying, "I have a loop to tell me when the web page has finished loading." The method you used works, but is not reliable. The browser may not be busy, but that doesn't mean the page is completed loaded. This is signaled by the ReadyState property being set to 4.
To make your macro more robust, I have added a time out routine. Currently the time out period is 10 seconds. You can make this longer or shorter if wish. Once the time out occurs, a message box informs you a time out has occurred. The web browser is displayed after dismissing the message, so you can see why this happened.
The API calls are needed to switch between Excel and Internet Explorer. Without these calls, the message boxes will be hidden until the user clicks on cell in Excel. During a time out, the browser window must be displayed on top of Excel.
Bookmarks