Previous Document Next Document

Understanding automation : How is automation coding structured? : Ending lines


Ending lines

In VBA, each statement must exist on its own line, but no special character is required to denote the end of each line. (In contrast, many other programming languages use a semicolon to separate individual statements.)

To break a long VBA statement over two or more lines, each of the lines (other than the last line) must end with an underscore (  _  ) preceded by at least one space:

newString = fooFunction ("This is a string", _
5, 10, 2)

You can combine several statements in a single VBA line by separating them with colons:

a = 1 : b = 2 : c = a + b

 
A VBA line cannot end with a colon. VBA lines that end with a colon are labels that are used by the Goto statement.

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.