The following function closes all IE Browser instnces qucikly...!!
' This function closes down all IE browser instances - quickly!
'Parameters: None
'Returns: True
Public Function CloseAllIEBrowsers()
' Windows Management Instrumentation (WMI) is the infrastructure for management data
' and operations on Windows-based operating systems. You can write WMI scripts or
' applications to automate administrative tasks on remote computers but WMI also supplies
' management data to other parts of the operating system and products, for example System
' Center Operations Manager, formerly Microsoft Operations Manager (MOM), or Windows
' Remote Management (WinRM).
' This technique shuts down the processes (as seen in the Task Manager) instead of
' closing the actual window using its handle. Close all IE Browsers using WMI:
' I used this technique as it seemed more reliable and consistent than other approaches.
Code:
strSQL = "Select * From Win32_Process Where Name = 'iexplore.exe'"
Set oWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set ProcColl = oWMIService.ExecQuery(strSQL)
For Each oElem in ProcColl
oElem.Terminate
Next
Set oWMIService = Nothing[size=small]
CloseAllIEBrowsers = True
End Function
Thanks,