Using macros in a template file - Metasys - LIT-12014183 - Software Application - Metasys Advanced Reporting System - 3.0

Metasys Report Engine User Guide

Product name
Metasys Advanced Reporting System
Document type
User Guide
Document number
LIT-12014183
Version
3.0
Revision date
2023-03-06
Product status
Active

You can use a Microsoft Excel file with defined marcos and filled with collected data as a template file. Before you save the template, the MRE can automatically call the template and checks for defined marcos. The MRE then calls the macros and saves the template.

In order for the MRE to call a macro, use an underscore at the beginning of your macro name. The MRE calls macros entered as xlFunction, which is a constant of values equal to 1.

Note: The MRE cannot call macros that take parameters.
To define marcos for the MRE complete the following steps:
  1. To open Visual Basic Editor, click Tools > Macros menu.
  2. Click ThisWorkbook.
  3. In the Cartel1 - ThisWorkbook window, from the Workbook list, click Workbook_Open.
  4. Enter the following code:
    Application.Names.Add _
    		      Name:="_MacroToExport", _
    		      RefersTo:="nullSheet!a1", _
    		      MacroType:=1 
    
    Note: The underscore before the name value prevents an exception.
  5. Repeat step 4, to add more than one macro.