Running macros

Macros are used to update the data in the Microsoft Word output generated from Rational® Publishing Engine. You can choose to run the macro directly from Rational Publishing Engine using the macro property or you can add it as a post-processing command to run it on the generated output.

Before you begin

Rational Publishing Engine comes with three files that contain macros that you can use. From the Central Management component or the %RPE_HOME%\utils\word\ directory in your installation files, you can find these files:
Table 1. Files that come with Rational Publishing Engine, which contain macros
File path and name Description
%RPE_HOME%\utils\word\rpe.dot

A stylesheet that contains macros.

%RPE_HOME%\utils\word\rpe_signed.dot

A stylesheet that contains macros.

%RPE_HOME%\utils\word\runmacro.vbs

A scripting file that can run macros.

Both rpe.dot and rpe_signed.dot contain the same styles and macros, but the rpe_signed.dot version contains an electronic signature for source verification. These files contain macros that can embed OLEs and update the output fields for Table of contents, Table of figure, and Table of table elements. The runmacro.vbs macro accepts 0 to 10 arguments for the Microsoft Word macro. You can use these macros or record your own.

About this task

When you use the macro property, the macro is run from Rational Publishing Engine and the data is updated before the output is generated. When you use the post-command property, the macro is run by Microsoft Word to update the data after the output is generated.
Note: If you are using variables in your macro argument, you must use the post-command property to run your macro.

Running the macro by using the macro property

About this task

Variables cannot be used in your argument.

Procedure

  1. Record or specify the macro in the Microsoft Word document that is being used as a style sheet.
  2. In the Launcher application, select the template listed in the document specification view.
  3. If you are using a stylesheet that contains macros, for the stylesheet property, enter the path to the document or style sheet that contains the macro.
  4. For the macro property, enter an argument. Example: macro_name macro_argument
  5. Generate the output.

Results

The macro is run from Rational Publishing Engine and the data is updated before the output is generated.

Running the macro by using the post-command property

About this task

System variable names, output names, and template variables can be used in your command.

Procedure

  1. Record or specify the macro in the Microsoft Word document that is being used as a style sheet.
  2. In the Launcher application, select the template listed in the document specification view.
  3. If you are using a stylesheet that contains macros, for the stylesheet property, enter the path to the document or style sheet that contains the macro.
  4. For the post-command property, enter an argument using the cscript command. The cscript command is used to start the Windows Script interpreter to run the macro. Example: cmd /c cscript "RPE_HOME\utils\word\runmacro.vbs" "${Word}" macro_name "${varA}"
    Note: If your argument contains white spaces, you must enclose the argument in quotation marks (" ").
  5. Generate the output. varA is replaced with the value of the variable specified in the template.

Results

The macro is run by Microsoft Word to update the data after the output is generated. varA is replaced with the value of the variable specified in the template.

Feedback