RunMacro

This command is only supported for Microsoft Word. It instructs Microsoft Word to open "Document" and run the specified macro. Microsoft Word executes the macro from the currently loaded templates and documents.

The macro must save and close any opened document, including the "Document," before terminating.

Interaction with the user is not possible, and the macro must provide non-interactive error handling.

Syntax

RunMacro 
   Document(<text>) 
   Macro(<text>) 
   Arg1(<text>)
   Arg2(<text>)
   ...
   Arg10(<text>)
   TimeOut(<number>);
	 

Parameters

  • Document: Required. Microsoft Word document that KCM Core loads. Currently only Microsoft Word is supported. The macro should save and close this document.
  • Macro: Required. The name of the macro that will be run.
  • Arg1: Optional. First parameter for the macro.
  • Arg2...Arg10: Optional. Second through tenth parameter for the macro. Allow the script to pass up to ten parameters to the macro.
  • TimeOut: Optional. The timeout for this command in seconds. If the WordProcessor exceeds this timeout, the process is terminated and KCM Core reports a run-time error. If this parameter is omitted, the appropriate default timeout value for either batch or interactive jobs is used. A timeout value of 0 disables the timeout.

Word macros

Example

RunMacro 
   Document("C:\temp\fox.doc")) 
   Macro("MyProject.MyModule.MyMacro")
   Arg1 ("First parameter")
   Arg2 ("Second parameter")
   Arg3 ("Third parameter")
   Arg4 ("Fourth parameter");