Using Macros in Excel Import/Export Files
A macro enables export to Excel and import to MEGA of calculated attribute values, for example: the result of a sum of whole numbers.
To use the VB macro creation wizard on an object of Business Document type:
1. In Tools > Options of MEGA, Repository folder, check that Metamodel Access option is "Expert".
2. Open the Excel WorkSheet properties.
3. In the Macro section, click the New button.
The macro creation wizard opens.
4. Select the check box corresponding to the type of macro you want to use, for example:
• "(VB) Script macro"
• "existing macro": to use an existing macro, of which field Reusable is selected.
5. Click Next.
6. Enter the Name of the macro.
7. If the macro you have created can be reused for another Excel import/export, select the Reusable box.
8. Click Finish.
The constraint appears in the properties dialog box.
The macro created contains by default the code of functions enabling encoding of operation of:
• Export, with the ColumnExport function that has as parameters:
• The object being exported.
• The list of header columns in the form of megafields.

This parameter is a character string that should be broken down using character "#" as separator.
• The index in the list of columns of the column being exported.
• Import, with the ColumnExport function that has parameters:
• The object being imported.

This object can be an object created by import or an existing object modified by import.
• The value of the Excel cell being imported.
• The list of header columns in the form of megafields.

This parameter is a character string that should be broken down using character "#" as separator.
• The list of values of cells of the row being imported.

This parameter is a character string that should be broken down using character "#" as separator.
• The index in the list of columns of the column being imported.