Declares the name, arguments, and code that form the body of a Function procedure.
|
---|
[Public [Default] | Private] Functionname [(arglist)]
[statements]
[name=expression]
[Exit Function]
[statements]
[name=expression]
End Function |
Arguments
- Public
Indicates that the Function procedure is accessible to all other procedures in all scripts.
- Default
Used only with the Public keyword in a Class block to indicate that the Function procedure is the default method for the class. An error occurs if more than one Default procedure is specified in a class.
- Private
Indicates that the Function procedure is accessible only to other procedures in the script where it is declared or if the function is a member of a class, and that the Function procedure is accessible only to other procedures in that class.
- name
Name of the Function; follows standard variable naming conventions.
- arglist
List of variables representing arguments that are passed to the Function procedure when it is called. Commas separate multiple variables.
- statements
Any group of statements to be executed within the body of the Function procedure.
- expression
Return value of the Function.
The arglist argument has the following syntax and parts:
[ByVal | ByRef] varname[( )]
Arguments
- ByVal
Indicates that the argument is passed by value.
- ByRef
Indicates that the argument is passed by reference.
- varname
Name of the variable representing the argument; follows standard variable naming conventions.
Remarks
Requirements
See Also