View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default VBA - Closing Outlook

Courtesy of Vasant Nanavati

Sub CloseOutlook()
Dim OL As Object
On Error Resume Next
Set OL = GetObject(, "Outlook.Application")
On Error GoTo 0
If OL Is Nothing Then
MsgBox "Outlook is not running!"
Else
OL.Quit
End If
End Sub

Regards

Trevor


"ajliaks " wrote in message
...
Hi all

I need to open Outlook an then closing it.
Opening function works well, but I do not know how to close it.

Could anyone help?
Thanks, Aldo.

I am using this:
'This is working well
Function OpeningOutlookInSelectedFolder()
Application.ActivateMicrosoftApp (xlMicrosoftMail)
End Function

'This is not working
Function ClosingOutlook()
Application.Close
End Function


---
Message posted from http://www.ExcelForum.com/