Skip to content

Latest commit

 

History

History
52 lines (31 loc) · 1.31 KB

Word.Document.Open.md

File metadata and controls

52 lines (31 loc) · 1.31 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Document.Open event (Word)
vbawd10.chm4001005
vbawd10.chm4001005
Word.Document.Open
80ad090c-69bf-b50e-3171-eab5414309a2
08/20/2018
medium

Document.Open event (Word)

Occurs when a document is opened.

Note

If you are working with a document embedded within another document, this event will not occur.

Syntax

Private Sub expression Private Sub Document_Open

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 opened and when the template itself is opened as a document.

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

Example

This example displays a message when a document is opened. (The procedure can be stored in the ThisDocument class module of a document or its attached template.)

Private Sub Document_Open() 
 MsgBox "This document is copyrighted." 
End Sub

See also

[!includeSupport and feedback]