Close All Browser

Posted by rajivkumarnandvani on February 5, 2009

‘ This function Close All open Browser
REM *************************************************************************

REM this function close All open browser

Public Function   fn_CloseAllBrowser()
While Browser(“CreationTime:=0”).Exist
End Function

REM *************************************************************************

Rem another way to close browser here  this function terminate application ‘process

rem like internet explorer exe will close from system process

dim sApplicationExe

sApplicationExe = “iexplore.exe”

Rem call function to close application process

call fn_CloseApplication( sApplicationExe)

REM This function kill the given process exe  through task manager

Public Function  fn_CloseApplication( byval sApplicationExe)
Dim strComputer
Dim objWMIService
Dim colProcesses
Dim objProcess
strComputer = “.”
Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2”)

Set colProcesses = objWMIService.ExecQuery (“Select * from Win32_Process Where Name = ‘”&sApplicationExe&”‘”)
For Each objProcess in colProcesses
Set objWMIService = Nothing
Set colProcesses=Nothing
End Function

REM through this function you can close any application process


3 Responses to “Close All Browser”

  1. Dev said

    Hi, Cool stuff. Great work bro……the examples and knowledge you have given is unique, and exceptioal…Thanks for your effort and time.

  2. Thanks Bro… 🙂


  3. RKN said

    Another method is:

    ***Close all internet explorer windows

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: