O'Reilly logo

Writing Word Macros, Second Edition by Steven Roman PhD

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Calling Subroutines

A subroutine declaration has the form:

	[Public or Private] Sub SubroutineName(Param1 As DataType1, _
	         Param2 As DataType2,...)

This is similar to the function declaration, with the notable absence of the As ReturnType portion. (Note also the word Sub in place of Function.)

Since subroutines do not return a value, they cannot be used within an expression. To call a subroutine named SubroutineA, we can write either:

	Call SubroutineA(parameters, . . .)

or simply:

	SubroutineA parameters, . . .

Note that any parameters must be enclosed in parentheses when using the Call keyword, but not otherwise.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required