Close Method

Applies To

AppointmentItem object, ContactItem object, Explorer object, Inspector object, JournalItem object, MailItem object, MeetingRequestItem object, NoteItem object, PostItem object, RemoteItem object, ReportItem object, TaskItem object, TaskRequestItem object.

Description

Explorer object: Closes the explorer. No information is saved.

Inspector or Outlook item object: Closes the inspector or item and optionally saves changes to the displayed Outlook item.

Syntax 1

expression.Close

Syntax 2

expression.Close(SaveMode)

expression An expression that returns an Explorer object (Syntax 1) or an Inspector or Outlook item object (Syntax 2).

SaveMode Required Long. The close behavior. Can be one of the following OlInspectorClose constants: olDiscard (discard all changes without prompting), olPromptForSave (prompt to save or discard all changes), or olSave (save all changes without prompting). The default value is olDiscard. If the item displayed within the inspector has not been changed, this argument has no effect.

Example

This example opens a mail message, adds a recipient to it to introduce a change, gets the inspector for the item, then closes the inspector, prompting the user to save changes.

Set myItem = = myOlApp.CreateItem(olMailItem)
myItem.Recipients.Add "David Goodhand"
Set myInspector = myItem.GetInspector
myInspector.Close olPromptForSave