View Full Version : How to use READYSTATE_COMPLETE
gelsner99
01-08-2013, 09:04 AM
Hi, I have a subroutine with just these 2 lines of code in it (please see below).
But I need it to wait until the "ReadyState_Complete" is complete after each statement. My knowledge of VBA is too low to be able to code that. What do you recommend?
ActiveWorkbook.Connections("Connection").Refresh
ActiveWorkbook.Connections("Connection1").Refresh
I'll appreciate your help a lot with this!
/ Gary E.:banghead:
BrianMH
01-08-2013, 10:06 AM
I believe readystate_complete is to with internet explorer not a workbook connection.
Try
ActiveWorkbook.Connections("Connection").backgroundquery = false
ActiveWorkbook.Connections("Connection").Refresh
ActiveWorkbook.Connections("Connection1").backgroundquery = false
ActiveWorkbook.Connections("Connection1").Refresh
gelsner99
01-09-2013, 12:02 PM
Brian,
When I run it; I get the error message "object doesn't support this property or method".
More explanation -- it does use Internet Explorer and the problem I'm having is; the first time I run it to fetch the data it doesn't bring in the 2nd part of the data at all. But then I run it again and it brings in both parts of the data just fine.
I have a feeling that you're very close to having a solution -- what else should I try?
Regards,
/ Gary E.
BrianMH
01-09-2013, 12:17 PM
ok with your ie object you need to do this first.
Do While ie.Busy Or ie.readyState <> READYSTATE_COMPLETE
DoEvents
Loop
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.