Back to

Running the query

Publishing macros in an Excel workbook

In Query, you can publish macros in Excel workbooks and customize aspects of the variables. You can also edit macros in that are already published to workbooks from within Query without opening VBA. Macros created in Query can be run in the Query and Runner clients and in the Runner add-in for Excel.

To publish a macro

  1. Create the macro in or copy it to a .txt file.
  2. In the Run pane, click Publish Macro.
  3. In the Winshuttle Macro Publisher dialog box, click Import.

    Browse to the location of the .txt file.

  4. Click Save to publish the macro.

To edit macros already published to workbooks

  1. In the Run pane, click Publish Macro.
  2. From the list in the Winshuttle Macro Publisher dialog box, select the macro you want to use. Click Edit.
  3. The text editor opens to accept your changes. Click Save.

To enable a macro as a button in a workbook

Note: Excel files that contain a space in their filename cannot contain buttons.

  1. In the Run pane, click Publish Macro.
  2. From the list, select the macro you want to use.
  3. Click Make Button.
  4. In the Caption box, name the button and in the Cell Address box and specify where you want the button to appear. Click OK.

To run a macro

  1. In the Run pane, click Publish Macro.
  2. From the list, select the macro you want to use. Click Run.

Macro templates

Macro templates are available for you to customize to your needs. To download templates, go to support.winshuttle.com.

The form can be generated from only one method specified in the <MN></MN> tag. Variables must be coded in the following format:

<WSM_Declaration><VN>Variable Name</VN><LT>Label Text</LT><DV>Default Value</DV><DT>Data Type</DT><MN>Method Name</MN></WSM_Declaration>

To add your own variables

  1. Click Publish Macro.
  2. Click Import to import the macro or template.
  3. Click Edit.
  4. Add the variables. Click Save.

Also in this section

Running

Running QUERY from the command line

Using the add-in for Excel

Using saved queries

Advanced run options