Article ID: 190241
Article Last Modified on 10/4/2002
Application.Run "Normal.Module1.MAIN" Application.Run "MyProject.MyModule.MyProcedure" Application.Run "'My Document.doc'!ThisModule.ThisProcedure"Visual Basic For Applications assigns names to macros in the following order:
project.module.procedure.When Visual Basic for Applications accesses the Microsoft Word Object model, a project can be either a template or document with stored procedures. In Visual Basic for Applications, the Word projects are named in the following manner:
Normal - all modules stored in the Normal.dot
TemplateProject - all modules store in the first file in the Startup
folder (if more than one template is in the startup
folder, Word uses the one that was copied
to the folder first and not by the alphabetical
listing order).
Project - additional startup templates, the template the open
file is based on, or an open saved document with a
module.
The following illustration describes how Visual Basic for Applications
handles Microsoft Word macros of the same name or macros and modules of the
same name in different template and document projects that are active.
Normal.NewMacros.Mymacro Project.NewMacros.Mymacro Project1.NewMacros.Mymacro TemplateProject.NewMacros.MymacroOpen the Visual Basic Editor by pressing ALT+F11. Then, press CTRL+R to view the following in Project Explorer:
Normal(Normal) Project(MyTemp) Project(MyDoc) TemplateProject(MyStart)If you want to run the macro in MyStart.dot, write your code as follows:
Application.Run "TemplateProject.NewMacro.macro1"
- or -
Normal.NewMacros.Mymacro = Normal.dot Project.NewMacros.Mymacro = MyTemp.dot Project1.NewMacros.Mymacro = MyDoc.doc
Additional query words: wordcon 8.0
Keywords: kbbug kbprb kbpending KB190241