Controlling Program Flow

Call

Call a subroutine

Choose

Return a value at a given index

Do...Loop

Execute a group of statements repeatedly

DoEvents (function)

Yield control to other applications

DoEvents (statement)

Yield control to other applications

End

Stop execution of a script

Exit Do

Exit a Do loop

Exit For

Exit a For loop

For...Next

Repeat a block of statement a specified number of times

GoSub

Execute at a specific label, allowing control to return later

Goto

Execute at a specific label

If...Then...Else

Conditionally execute one or more statements

IIf

Return one of two values depending on a condition

Main

Define a subroutine where execution begins

Return

Continue execution after the most recent GoSub

Select...Case

Execute one of a series of statements

Sleep

Pause for a specified number of milliseconds

Stop

Suspend execution, returning to a debugger (if present)

Switch

Return one of a series of expressions depending on a condition

While...Wend

Repeat a group of statements while a condition is True

More information

Language elements by category