Article ID: 184627
Article Last Modified on 7/16/2007
Application.Run strMacroNameOr, if you are using literal strings:
Application.Run "Normal.Module1.MAIN" Application.Run "MyProject.MyModule.MyProcedure" Application.Run "'My Document.doc'!ThisModule.ThisProcedure"If you specify the document or template name, your code can run macros only in documents or templates related to the current context; it cannot run any macro in any document or template.
<ProjectName>.<ModuleName>.<MacroName>
Application.Run MacroName:="<ProjectName>.<ModuleName>.<MacroName>"In cases where you call a literal string such as "AutoExec.Main", you must remove the quotation marks, as shown in the following example:
CALL AutoExec.MainNOTE: You cannot pass parameters to a macro by using the Run method.
CALL <subroutinename>where <subroutinename> is the name of the subroutine.
Call [<ProjectName>].[<ModuleName>].<Macro_or_ProcedureName>where <Project> is the name of the template or document, <Module> is the name of the module, and <Macro_or_ProcedureName> is the name of the macro or procedure.
CALL strMacroName
-and-
CALL "AutoExec.main"
176476 OFF: Office Assistant Not Answering Visual Basic Questions
163435 VBA: Programming Resources for Visual Basic for Applications
164058 Passing Procedure Arguments in Visual Basic for Applications
165518 Calling Macros Using OLE from MS Visual Basic for Applications
181058 OFF98: How to Run Sample Code from Knowledge Base Articles
Additional query words: wordcon offcon vb vba vbe
Keywords: kbdtacode kbnofix kbprb KB184627