Document.CodeName property (Word)

Returns the code name for the specified document. Read-only String.

Syntax

expression. CodeName

expression A variable that represents a Document object.

Remarks

The code name is the name for the module that houses event macros for a document. The default name for the module is "ThisDocument"; you can view it in the Project window. For information about using events with the Document object, see Using events with the Document object.

Example

This example returns the name of the code window for the active document.

Msgbox ActiveDocument.CodeName

See also

Document Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.