Solved

Starting IE up - need to pause code until IE ready for navigate command

Posted on 2007-04-11
3
176 Views
Last Modified: 2010-04-30
Occasionally my code restarts Internet Explorer on purpose using:

objIE.Quit
Set objIE = Nothing
Set objIE = New InternetExplorer
objIE.Visible = True

But it seems that sometimes, the code sends a navigate command to IE a little too soon after restarting. IE isn't ready and errors out. I've inserted a 3 second pause, and that has seemed to help, but I still occasionally get the same error. How can I hold all further instruction until IE is up and ready to receive commands?
0
Comment
Question by:JohnDoeSr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
quiklearner earned 250 total points
ID: 18892910
unless you get some sort of event out of your objie object i am not sure you can..  if you do get a error to bubble back when it is not, trap it and retry the command until it works (probably a good idea to put a count on it though to stop eventually)
0
 
LVL 12

Expert Comment

by:jkaios
ID: 18893298
You can implement a loop to wait until the current page is loaded or the state is ready.

Do Until (objIE.ReadyState = 4)   'READYSTATE_COMPLETE
   DoEvents
Loop

-OR- use this:

Do While (objIE.Busy)
   DoEvents
Loop
0
 

Author Comment

by:JohnDoeSr
ID: 18894322
quiklearner: If I can't find any other solution then it sounds like I'm going to have to do this

jkaios: I've already got got that code in, right after the new the IE visible = true and it doesn't seem to help.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question