Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Close Method

Office 2003

For the Explorer object, the Close method closes the explorer.

For an Inspector or Microsoft Outlook item object, the Close method closes the inspector or item and optionally saves changes to the displayed Outlook item.

expression.Close(SaveMode)

expression     Required. An expression that returns one of the objects in the Applies To list.

OlInspectorClose can be one of these OlInspectorClose constants.
olDiscard Discard all changes without prompting.
olPromptForSave Prompt to save or discard all changes.
olSave Save all changes without prompting.

Example

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 myolapp As Outlook.Application
	Dim myinspector As Outlook.Inspector
	Dim myItem As Outlook.MailItem
	Set myolapp = CreateObject("Outlook.Application")
	Set myinspector = myolapp.ActiveInspector
	Set myItem = myinspector.CurrentItem
	myItem.Close olSave
End Sub
		

If you use Microsoft Visual Basic Scripting Edition (VBScript) in an Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to create a mail item, add a recipient, and close the item after prompting the user to save changes.

Set myItem = Application.CreateItem(0)
myItem.Recipients.Add "David Goodhand"
myItem.Close 2
		




Show:
© 2015 Microsoft