Document.Close (Word)

Closes the specified document.

Close (SaveChanges, OriginalFormat, RouteDocument)


On Error GoTo errorHandler 
ActiveDocument.Close _ 
 SaveChanges:=wdPromptToSaveChanges, _ 
 OriginalFormat:=wdPromptUser 
errorHandler: 
If Err = 4198 Then MsgBox "Document was not closed"

Arguments

Optional arguments

The following arguments are optional

SaveChanges (WdSaveOptions) - Specifies the save action for the document. Can be one of the following WdSaveOptions constants: wdDoNotSaveChanges, wdPromptToSaveChanges, or wdSaveChanges.

Possible return values are wdDoNotSaveChanges - Do not save pending changes, wdPromptToSaveChanges - Prompt the user to save pending changes, wdSaveChanges - Save pending changes automatically without prompting the user.

OriginalFormat (WdOriginalFormat) - Specifies the save format for the document. Can be one of the following WdOriginalFormat constants: wdOriginalDocumentFormat, wdPromptUser, or wdWordDocument.

Possible return values are wdOriginalDocumentFormat - Original document format, wdPromptUser - Prompt user to select a document format, wdWordDocument - Microsoft Word document format.

RouteDocument (Boolean) - True to route the document to the next recipient. If the document does not have a routing slip attached, this argument is ignored.