strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colIEProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'iexplore.exe'")
For Each objProcess in colIEProcessList
objProcess.Terminate()
Next
End Function
5 comments:
hi
Why is that much procedure needed to close all the opened IE browsers
Use simply -
SystemUtil.CloseByProcessName "iexplore.exe"
that's it..
You r Correct Sreenu.
But if you want to write your own method to close this is the way.
I use • Close all IE browsers: SystemUtil.CloseProcessByName("iexplore.exe")
Both are different.
SystemUtil.CloseProcessByName("iexplore.exe")
It will throw a validation error if no instances are open in the above case.
But if the mentioned function is used. it will close all/any open instances .
Post a Comment