DocumentBase.Close Method

Closes the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public Sub Close ( _
    ByRef saveChanges As Object, _
    ByRef originalFormat As Object, _
    ByRef routeDocument As Object _
)
public void Close(
    ref Object saveChanges,
    ref Object originalFormat,
    ref Object routeDocument
)

Parameters

  • routeDocument
    Type: System.Object%
    true to route the document to the next recipient. If the document does not have a routing slip attached, this argument is ignored.

Remarks

Optional Parameters

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

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 Sub DocumentClose()
    Me.Close(Word.WdSaveOptions.wdPromptToSaveChanges, _
        Word.WdOriginalFormat.wdWordDocument, True)
End Sub
private void DocumentClose()
{
    object saveChanges = Word.WdSaveOptions.wdPromptToSaveChanges;
    object originalFormat = Word.WdOriginalFormat.wdWordDocument;
    object routeDocument = true;

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

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace