Code related procedures in class Document (Word VBA)

This page presents procedures from class Document related to the theme Code: CodeName, VBASigned, VBProject and ViewCode


Returns the code name for the specified document.

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.

Msgbox ActiveDocument.CodeName


True if the Microsoft Visual Basic for Applications (VBA) project for the specified document has been digitally signed.

Documents.Open FileName:="C:\My Documents\Temp.doc" 
If ActiveDocument.VBASigned = False Then 
 MsgBox "Warning! This document " _ 
 & "has not been digitally signed.", _ 
 vbCritical, "Digital Signature Warning" 
End If


Returns the VBProject object for the specified template or document.

Use this property to gain access to code modules and user forms. To view the VBProject object in the object browser, you must select the Microsoft Visual Basic for Applications Extensibility check box in the References dialog box (Tools menu) in the Visual Basic Editor.

Set currProj = ActiveDocument.VBProject 
MsgBox currProj.Name


Displays the code window for the selected Microsoft ActiveX control in the specified document.

This method is available only from outside Microsoft Word.