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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Close all instances of Internet Explorer 2

Status
Not open for further replies.

hilbertl3

Technical User
Sep 22, 2004
77
US
All,

I am trying to open an IE window on a button click in an Access form and then and close IE on a button click on the same Access form. I have the code to open the window and to close the window, but this code only works for the original Explorer window that was opened. If the user clicked links in the original window that opened secondary IE windows, those secondary windows are not being closed. How could I make sure that on a button click all open IE windows were closed? The code I have so far is included below.

Thanks,

hilbertl



Public IeApp As InternetExplorer


Sub OpenWindow()

Dim URL As String
Dim IeDoc As Object
Dim i As Long

Set IeApp = New InternetExplorer
IeApp.Visible = True
URL = " IeApp.Navigate URL
Do
Loop Until IeApp.ReadyState = READYSTATE_COMPLETE
Set IeDoc = IeApp.Document


End Sub

Sub closewindow
IeApp.Quit
Set IeApp = Nothing
End Sub
 
Hi,

I use this code for closing outlook.exe, it should be possible to use it for other apps as well.
Code:
Dim objProcesses, objProcess
    Set objProcesses = GetObject("WinMgmts:root/CIMV2").ExecQuery("SELECT * FROM Win32_Process WHERE Name='OUTLOOK.EXE'")
    For Each objProcess In objProcesses
      objProcess.Terminate
    Next

EasyIt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top