In some cases, you may want to carry out an action or series of actions in a macro only if a particular condition is True.
A condition is a logical expression. If a condition evaluates to True, Newlook carries out the action in that row and continues to sequentially execute any macro row whose conditions are satisfied, until it reaches the end of the macro or some other action that stops execution (for example a GoToMacro, StopMacro or StopAllMacros action).
If a condition evaluates to False, execution will skip to the next row.
You can have Newlook carry out a series of actions if the condition is True by typing an ellipsis (...) in the Condition column of the actions that immediately follow the condition.
Conditions specified via ellipsis in the Condition column of the actions that immediately follow the condition are not re-evaluated.
For Example:
You may decide to use a macro to validate data in a form. You would like to display one message in response to one set of values entered, and another message in response to a different set of values. In a scenario like this, you could use conditions to control the flow of the macro.
The following macro shows you how you might go about such a task. The Condition rc = MsgOK
in line 2 and 3 ensure that the first MsgBox and StopMacro actions will only be executed when the rc
variable equals the message box OK button constant (MsgOk).
If rc equals anything else then those two lines will not be executed and the second MsgBox action will run.
An ellipsis (...) specified in the condition column of the first row is treated as though it is a blank condition.
If the condition expression evaluates to a Boolean then quotes are not
needed. blnPrintRequested = True
is a valid condition.
If the condition expression evaluates to a String then quotes are needed.
ActiveForm.Name = "Sign On"
is a valid condition.
If the condition expression evaluates to a number then quotes are not
needed. intNumberPages = 10
is
a valid condition.
If the condition compares two variables then quotes are not needed.
intNumberPages
= intPagesPrinted
is a valid condition.