In
VBA, a
statement typically extends to the end of line. In order to span a statement over multiple lines, the unserscore (
_
) must be used. In VBA's terminology, this character is also referred to as
line continuation character.
The underscore must be set apart from its preceding character or symbol by at least one whitespace.
Simple demonstration of line continuation
The following simple demonstration code spreads a calculation over three lines, possibly for better visual clarity:
option explicit
sub main() ' {
debug.print "The result of the summation is: " _
4 + 5 + 9 + 10 + _
3 + 1 + 8 + 7
end sub ' }