VBProject Property Example

This example displays the name of the Visual Basic project for the Normal template.

Set normProj = NormalTemplate.VBProject
MsgBox normProj.Name

This example displays the name of the Visual Basic project for the active document.

Set currProj = ActiveDocument.VBProject
MsgBox currProj.Name

This example adds a standard code module to the active document and renames it "MyModule."

Set newModule = ActiveDocument.VBProject.VBComponents _
    .Add(vbext_ct_StdModule)
NewModule.Name = "MyModule"