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!

Problem whit IE with VBscript

Status
Not open for further replies.

taz97

Programmer
Jun 7, 2001
17
CA
Sorry for my english, i'm french speaking.
This code below work fine but when the IE windows is opened and We click on the "X" (close button, upper right) we receive an error message. If We click "cancel" there is no problem because we trap this. How can we trap the "X" for quiting the program ? If we add the "On error resume" we don't have no more this error but the program is looping. Thanks for your help !



Set objExplorer = WScript.CreateObject _
("InternetExplorer.Application", "IE_")

objExplorer.Navigate "file://D:\Deploiement_EE\deploiement_EE.html"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 250
objExplorer.Visible = 1
Do While (objExplorer.Document.Body.All.OKClicked.Value = "")
Wscript.Sleep 250
Loop

strComputer = objExplorer.Document.Body.All.OKClicked.Value
objExplorer.Quit
Wscript.Sleep 250
If strComputer = "Cancelled" Then
Wscript.Quit
End If
 
Also, the is web site where we can have the full listing of the class of objExplorer

Something like this:
objExplorer.Document.Body.All.OKClicked.Value
objExplorer.Document.Body.InnerHTML
objExplorer.Document.Body.All.UserPassword.Value
...
...
Thanks
 
Hey Taz,

Here is a quick easy way to trap the IE Quit event.
Just add this "_onQuit" Sub to your script:

Set objExplorer = WScript.CreateObject _
("InternetExplorer.Application", "IE_")
objExplorer.Navigate "file://D:\Deploiement_EE\deploiement_EE.html"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 400
objExplorer.Height = 250
objExplorer.Visible = 1

Sub IE_onQuit
WScript.Echo "Please don't close that window!"
'This is a good place to restart your IE instance
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top