Export (0) Print
Expand All
Expand Minimize

Document.Close Method

Closes the document.

Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)

public virtual void Close (
	[OptionalAttribute] ref Object SaveChanges,
	[OptionalAttribute] ref Object OriginalFormat,
	[OptionalAttribute] ref Object RouteDocument
)

Parameters

SaveChanges

Specifies the save action for the document. Can be one of the following WdSaveOptions values: wdDoNotSaveChanges, wdPromptToSaveChanges, or wdSaveChanges.

OriginalFormat

Specifies the save format for the document. Can be one of the following WdOriginalFormat values: wdOriginalDocumentFormat, wdPromptUser, or wdWordDocument.

RouteDocument

true to route the document to the next recipient. If the document does not have a routing slip attached, this argument is ignored.

Optional Parameters

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

The following code example uses the Close method to close the document and prompt the user to save changes as a Word (.doc) file.

private void DocumentClose()
{
    object saveChanges = Word.WdSaveOptions.wdPromptToSaveChanges;
    object originalFormat = Word.WdOriginalFormat.wdWordDocument;
    object routeDocument = true;

    this.Close(ref saveChanges, ref originalFormat, ref routeDocument);
}

Show:
© 2014 Microsoft