Skip to content

Latest commit

 

History

History
55 lines (30 loc) · 1.28 KB

Word.Document.Close(even).md

File metadata and controls

55 lines (30 loc) · 1.28 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Document.Close event (Word)
vbawd10.chm4001006
vbawd10.chm4001006
Word.Document.Close
7758dbae-b624-d3b0-f42c-1404d40ecc78
06/08/2017
medium

Document.Close event (Word)

Occurs when a document is closed.

Syntax

expression.**Close'()

expression A variable that represents a Document object.

Remarks

If the event procedure is stored in a template, the procedure will run when a new document based on that template is closed and when the template itself is closed (after being opened as a document).

For information about using events with a Document object, see Using events with the Document object.

Example

This example makes a backup copy of the document on a file server when the document is closed. (The procedure can be stored in the ThisDocument class module of a document or its attached template.)

Private Sub Document_Close() 
 ActiveDocument.Save 
 ActiveDocument.SaveAs "\\network\backup\" & ThisDocument.Name 
End Sub

See also

Document Object

[!includeSupport and feedback]