Internet explorer object questions

T

Tim Coddington

Is it better to go ...
Dim ie As InternetExplorer
Set ie = New InternetExplorer
or
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")

I had been using the former, but now I see examples in texts of the latter.
Here is another ...

It it better to go ...
Do
Loop Until ie.ReadyState = READYSTATE_COMPLETE
or
Do While ie.Busy
Loop

And is a 'DoEvents' useful in the Do loop?

Does ie.Silent keep the 'You are now exiting a secure web page' box from
popping up?

Thanks very much for your input!
 
G

Guest

1) you're question refers to what is called early binding - where you dim a
variable explicitly, and late binding, where the variable is an object. Early
binding has several advantages. The developer is able to use intellisense ie
the objects properties and methods are exposed at design time, and
compilation is faster making more compact code...the compiler knows what the
object is. Late binding of course means that without a specific type, there's
no intellisense and the compiler has to allow extra memory etc. The biggest
advantage I see for late binding is that for applications like Excel, the
createobject method doesn't care where the app is installed.

2) use DoEvents .... it releases control back to the O/S so that other
processes and interrupts can get picked up and processed.

3) For what its worth, if you us eth eie object in a standard module you
lose any abilitu to use events, I suggest that you use the Dim WithEvents in
say a class module ( a userform is also a type of class module). This way,
when you ie object fires events like page loaded, yousr code can trap it and
react accordingly.

HTH
Patrick Molloy
Microsoft Excel MVP
 
T

Tim Coddington

Great. My thanks.
I guess I am able to use the early binding then, since I always know where I
am installed.
Dim ie As InternetExplorer
Set ie = New InternetExplorer
and
do
DoEvents
loop

Is ie.Busy basically the same as ie.ReadyState = READYSTATE_COMPLETE?
Does ie.Silent keep the 'You are now exiting a secure web page' box from
popping up?


Item 3) brings me to my next question; how to trap the NewWindow2 event.
Never built a class module yet, and don't belive I'm free to use a userform,
so I've got some reading to do. Thanks much. Great group!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top