Close Method
TOC
Collapse the table of content
Expand the table of content

MailItem.Close Method (Outlook)

Office 2013 and later
GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

Closes and optionally saves changes to the Outlook item.

expression .Close(SaveMode)

expression A variable that represents a MailItem object.

Parameters

Name

Required/Optional

Data Type

Description

SaveMode

Required

OlInspectorClose

The close behavior. If the item displayed within the inspector has not been changed, this argument has no effect.

This Visual Basic for Applications (VBA) example saves and closes the item displayed in the active inspector without prompting the user. To run this example, you need to have an item displayed in an inspector window.

Sub CloseItem() 
 
 Dim myinspector As Outlook.Inspector 
 
 Dim myItem As Outlook.MailItem 
 
 
 
 Set myinspector = Application.ActiveInspector 
 
 Set myItem = myinspector.CurrentItem 
 
 myItem.Close olSave 
 
End Sub
Show:
© 2016 Microsoft