Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA - IE unloading/exiting ????

Status
Not open for further replies.

cresbydotcom

Technical User
May 22, 2006
234
I got this code from but I can't see how to unload the specific instance of ie created.

tried ie.Unload, .Exit, .Close
Object Browser and watch properties give no clue.

any ideas anyone?

Not sure how to invoke the menubar etc but values below seem to be unimportant.

Code:
With ie
    .Navigate strURL
    .MenuBar = True
    .StatusBar = True
    .Toolbar = 0
    .Visible = True
    .Silent = False
    .Addressbar = True
        Do While ie.ReadyState <> 4: DoEvents: Loop 'wait for IE to finish
    With .Document.body
        'readHTML = .innerhtml
        readTEXT = .innerTEXT
    End With

there is a tide in the affairs of man that you Cnut ignore.................
 
Have you tried ie.Quit ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You shouldn't exit an object whilst referring to it in a WITH statement

With IE
'do stuff
End with

IE.Quit

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
I will try .Quit

I was trying it outside the With block.

For some reason the loading from website feels a lot quicker, but I won't prove that till next week when there will be a load of truly fresh web pages. The site does seem to load from the temp file and I have done a lot of repeated attempts today.

Thanks a lot.



there is a tide in the affairs of man that you Cnut ignore.................
 

I just had IE7 installed against my wishes because there is always a "but". And this is the worst so far.

The code above that used to work a treat now has a fault where when it gets past the
Code:
        Do While ie.ReadyState <> 4: DoEvents: Loop 'wait for IE to finish
line it can sometimes bomb-out because
Code:
        readTEXT = .innerTEXT
has an error. Basically .innerTEXT is empty.

I have tried adding delays but it is as if the previous instance of the window has not been released. It is almost related to "if parts of the page are not in the local temp folder" but not entirely.
There is a loop over the codes so I am looking at 14 pages in sequence then closing the browser each time.
Should I just put a line in to change the URL rather than close down the browser?
Any quick ideas on the code?

TIA

there is a tide in the affairs of man that you Cnut ignore.................
 
I lied. It was keeping the same instance of the browser and just changing the URL. However I was setting a few things more often than necessary so I "iffed" it to do it once. eg
Code:
    .Navigate strURL
    If n = 1 Then
    .MenuBar = True
    .StatusBar = True
    .Toolbar = 0
    .Visible = True
    .Silent = False
    .Addressbar = True
    End If
Seems better but it maybe our broadband connection here at work that is causing probloems, it is still hunting for best speed.

there is a tide in the affairs of man that you Cnut ignore.................
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top