01-22-2012, 03:48 PM
Hi,
im trying to use WMI to close all browsers.
thats my function:
problem is that when it finish closing the browsers it perform another iteration and poping an error that oElem was not found (see attachment)
Thank you so much!
im trying to use WMI to close all browsers.
thats my function:
Code:
Sub CloseAllBrowsers()
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
End Sub
problem is that when it finish closing the browsers it perform another iteration and poping an error that oElem was not found (see attachment)
Thank you so much!