Name
Function Statement
Syntax
[Public [Default] | Private Functionname[(arglist)] [( )] [statements] [name=expression] [Exit Function] [statements] [name=expression] End Function
-
Public Use: Optional
Type: Keyword
Gives the function scope through all procedures in all modules in the project. If used within a class construct, the function is also accessible from outside the project.
PublicandPrivateare mutually exclusive.-
Default Use: Optional
Type: Keyword
Defines a method as the default member of a class. It is valid only for a public function (i.e., one defined using the
Publickeyword) defined within aClass...End Classstatement. Only one property or method in a class block can be defined as the default member of the class.-
Private Use: Optional
Type: Keyword
Restricts the scope of the function to those procedures within the same module.
-
name Use: Required
The name of the function.
-
arglist Use: Optional
A comma-delimited list of variables to be passed to the function as arguments from the calling procedure.
-
statements Use: Optional
Program code to be executed within the function.
-
expression Use: Optional
The value to return from the function to the calling procedure.
-
arglistuses the following syntax and parts: [ByVal | ByRef]
varname[( )-
ByVal Use: Optional
Type: Keyword
The argument is passed by value; that is, the local copy of the variable is assigned the value of the argument.
-
ByRef Use: Optional
Type: Keyword
The argument is passed by reference; that is, the local variable is ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access