Running Macros

Running Macros

You can configure the SaveToDB add-in to launch Excel macros, which provides several advantages:

  • All user actions are accessible via the Excel context menu and the SaveToDB Actions menu.
  • Macros are tied to specific queries and are available immediately after connecting to data.
  • Macros can accept input parameters from table columns, query parameters, and named cells.

Macros can reside in active workbooks or in separate macro workbooks that can be updated independently.

Specify macros in the HANDLER_CODE field using the following format:

<Excel macro> [<Parameter1>[, <Parameter2>[, ...]]

For example:

IDTABLE_SCHEMATABLE_NAMECOLUMN_NAMEEVENT_NAMEHANDLER_SCHEMAHANDLER_NAMEHANDLER_TYPEHANDLER_CODE
 dbotestContextMenudboRun HelloWorld MacroMACROHelloWorld

Macros can utilize context values in the following formats: {ParameterName=DefaultValue} or simply {ParameterName}.

For example:

SayHello "World"
SayHello {Name=World}
Sheet1.SayHello {FirstName}, {LastName}
MacroWorkbook.xlsm!SayHello {FirstName}, {LastName}

Keep in mind that a macro sheet name is an internal Excel name, not the user-visible name.
You can check macro names using the Excel dialog box for launching macros (Alt-F8).

Important! Only run macros from trusted sources! SaveToDB does not validate macros.

This website is using cookies. By continuing to browse, you give us your consent to our use of cookies as explained in our Cookie Policy.