Document Events (Word)

GitHub-Mark-64px

Contribute to this content

Use GitHub to suggest and submit changes. See our guidelines for contributing to VBA documentation.

This object has the following events:

Events

Name

Description

BuildingBlockInsert

Occurs when you insert a building block into a document. .

Close

Occurs when a document is closed.

ContentControlAfterAdd

Occurs after adding a content control to a document.

ContentControlBeforeContentUpdate

Occurs before updating the content in a content control, but only when the content comes from the Office XML data store.

ContentControlBeforeDelete

Occurs before removing a content control from a document.

ContentControlBeforeStoreUpdate

Occurs before updating the document's XML data store with the value of a content control.

ContentControlOnEnter

Occurs when a user enters a content control.

ContentControlOnExit

Occurs when a user leaves a content control.

New

Occurs when a new document based on the template is created. A procedure for the New event will run only if it is stored in a template.

Open

Occurs when a document is opened.

Sync

This object or member has been deprecated, but it remains part of the object model for backward compatibility. You should not use it in new applications.

XMLAfterInsert

Occurs when a user adds a new XML element to a document. If more than one element is added to the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is inserted.

XMLBeforeDelete

Occurs when a user deletes an XML element from a document. If more than one element is deleted from the document at the same time (for example, when cutting and pasting XML), the event fires for each element that is deleted.