Using Parentheses in Code
Sub procedures, built-in statements, and some methods don't return a value, so the arguments aren't enclosed in parentheses. For example:
|
Function procedures, built-in functions, and some methods do return a value, but you can ignore it. If you ignore the return value, don't include parentheses. Call the function just as you would call a Sub procedure. Omit the parentheses, list any arguments, and don't assign the function to a variable. For example:
|
To use the return value of a function, enclose the arguments in parentheses, as shown in the following example.
|
A statement in a Sub or Function procedure can pass values to a called procedure using named arguments. The guidelines for using parentheses apply, whether or not you use named arguments. When you use named arguments, you can list them in any order, and you can omit optional arguments. Named arguments are always followed by a colon and an equal sign (:=), and then the argument value.
The following example calls the MsgBox function using named arguments, but it ignores the return value:
|
The following example calls the MsgBox function using named arguments and assigns the return value to the variable
|
|