次の方法で共有


DocumentBase.Close(Object, Object, Object) Method

Definition

Closes the document.

public void Close (ref object saveChanges, ref object originalFormat, ref object routeDocument);
member this.Close : obj * obj * obj -> unit
Public Sub Close (Optional ByRef saveChanges As Object, Optional ByRef originalFormat As Object, Optional ByRef routeDocument As Object)

Parameters

saveChanges
Object

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

originalFormat
Object

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

routeDocument
Object

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

Examples

The following code example uses the Close method to close the document and prompt the user to save changes as a Word (.doc) file. To use this example, run it from the ThisDocument class in a document-level project.

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

    this.Close(ref saveChanges, ref originalFormat, ref routeDocument);
}
Private Sub DocumentClose()
    Me.Close(Word.WdSaveOptions.wdPromptToSaveChanges, _
        Word.WdOriginalFormat.wdWordDocument, True)
End Sub

Remarks

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

Applies to