Close All Instances of Microsoft Outlook with VBA

B

bobdydd

Hi Everybody

Windows XP, Access 2000, Outlook 2000

I am looking for a way to Close All Instances of Microsoft Outlook,
with VBA.

Both the "Seen One" and the unseen ones that you see when
you do a Ctrl Alt Del, and see them all sitting there in the task
manager.

I would like to have a Command Button that shuts them all.

Regards Bob
 
A

arthurjr07

Dim objs as Object
Dim obj as Object
Dim strSQL as String
Dim strWMI as String
strWMI = "winmgmts:"
strSQL = "Select * From Win32_Process "
strSQL = strSQL & "where Name = 'OUTLOOK.EXE'"
Set objs = GetObject(strWMI).ExecQuery(strSQL)
For Each obj In objs
obj.Terminate
Next
Set objs = Nothing


HTH
Arthur
 
A

arthurjr07

Dim objs as Object
Dim obj as Object
Dim strSQL as String
Dim strWMI as String
strWMI = "winmgmts:"
strSQL = "Select * From Win32_Process "
strSQL = strSQL & "where Name = 'OUTLOOK.EXE'"
Set objs = GetObject(strWMI).ExecQuery(strSQL)
For Each obj In objs
obj.Terminate
Next
Set objs = Nothing


HTH
Arthur
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top