Close Method Example

This Visual Basic for Applications example uses CreateItem to open a mail message, adds a recipient to it to introduce a change, then uses the Close method to close the item and prompt the user to save changes.

Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.Recipients.Add "David Goodhand"
myItem.Close olPromptForSave

If you use VBScript, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript.

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