Application.MailLogoff method (Project)

Closes an established MAPI mail session.

Syntax

expression. MailLogoff

expression A variable that represents an Application object.

Return value

Nothing

Example

The following example checks for an existing mail session and logs off it. If not logged on, the following example logs on, downloads any new mail, and then logs off.

Sub LogoffFromMail() 
 
 If Not IsNull(MailSession) Then 
 MsgBox "Logging off mail session: " & MailSession 
 Application.MailLogoff 
 Else 
 MsgBox "Logging on to mail session now." 
 Application.MailLogon DownloadNewMail:=True 
 MsgBox "Logging off mail session: " & MailSession 
 Application.MailLogoff 
 End If 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.