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
- saveChanges
Type: System.Object%
Specifies the save action for the document. Can be one of the following WdSaveOptions values: wdDoNotSaveChanges, wdPromptToSaveChanges, or wdSaveChanges.
- originalFormat
Type: System.Object%
Specifies the save format for the document. Can be one of the following WdOriginalFormat values: wdOriginalDocumentFormat, wdPromptUser, or wdWordDocument.
- 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.