DriveWorks Pro 16: Run Macro in a Loop [send feedback...]

Run Macro in a Loop

The Run Macro in a Loop task will run a macro in the project the number of times specified by the Start, Limit and Increment Values.


Property NameDescription
DeferTrue to defer the execution of the macro until after the project's design master has been saved. False to run immediately.
Macro Argument

Provides an optional argument to the macro.

Click here for more information...
Macro NameThe name of the macro in the project's design master.
TitleChanges the Title (not the name) of the task.
Counter ConstantOptional. The name of a constant which will receive the loop counter value on each iteration.
Increment ValueControls the value added to the loop counter on each iteration, this will be positive to step up and negative to step down.
Limit ValueControls the limiting value of the loop counter.
Start ValueControls the initial value of the loop counter.


When this task is added the properties are static by default.
See How To: Change A Static Property To A Dynamic Property to enable rules to be built on these properties.

Property NameExample RuleExample ResultMeaning
DeferFALSEFALSEFALSE will run this Task immediately.
DeferTRUETRUETRUE would defer this Task until after the project's design master had been saved.
Macro ArgumentDWCurrentMacroArgument1Will be the Macro Argument used by the Macro running in a loop.This can then be used in rules. Find more information here
Macro Name"Export to table"Export to tableThis is the name of the Macro you want to run.
Counter ConstantDWConstantLoopingConstantDWConstantLoopingConstantWill increase the specified constant every time the loop is carried out.
Increment Value11Will add 1 to the loop counter of each iteration. This is positive so will step up.
Limit ValueTableMaxValue(DWLookupCustomers,1)10The loop counter will be limited to this number of loops. The rule is finding the maximum value that the table goes to and sets that as the limit
Start Value11The loop counter will start at this value

DriveWorks Tech Tips Portal

Copy Table

Shows how you can copy data from one Simple Table to another, remove selected rows and clear the whole table using macros.

View all Tech Tips

DriveWorks Tech Tips Portal is available to DriveWorks Pro customers with an active subscription and support contract.

Tech Tips provide cut down projects that highlight specific functionality for faster and more effective learning.

To access the portal:

  1. Go to
  2. Login with your DriveWorks Pro account credentials, if asked
  3. Click the Visit Tech Tips Portal button for access

The portal provides a search facility, start typing the name of the Tech Tip (as indicated above) to display the Tip you require.

Table of Contents