ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA InternetExplorer ReadyState loop (https://www.excelbanter.com/excel-programming/291956-vba-internetexplorer-readystate-loop.html)

Jason livesay

VBA InternetExplorer ReadyState loop
 
I have a Word macro that prints account data from our intranet
application using an InternetExplorer object.

I wanted to print the account data for the accounts listed in my
spreadsheet, so I copied the class into my spreadsheet.

Internet Explorer seems to hang in my HttpPost sub -- specifically, I
have a do doevents until readystate = readystatecomplete (whatever it
is 4) and readystate is 1 indefinitely and then I have to end the
Internet Explorer process forcefully. The HttpPost sub converts the
postdata and calls Navigate, then waits for Busy and ReadyState to
clear. Two strange (but typical I suppose) things: 1)this is the same
code that works fine in Word and 2) it doesnt hang if I break at the
top of the HttpPost routine and step through the code one line at a
time.

If anyone knows WTH is going on and how to fix it, let me know. I am
thinking maybe I will try adding more .Busy and .ReadyState loops in
there before the Navigate (although if I recall I one set of them
already) or maybe some kind of timer delay.


All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com