Function
Define a function procedure.
Syntax
[Public [Default] | Private ] Function name([arg_List])
[statements]
[name=expression]
Exit Function
[statements]
[name=expression]
End Function
Key
Public Extend the scope of this function to all procedures in the project.
Public Default Define a method as the default member of a class
(Only for public functions defined within a class.)
Private Restrict the scope of this function to procedures within the same module.
name The name of the function.
arg_List Argument variabless passed to the function, comma separated.
By default, each local variable=argument (ByRef)
To have each local variable=value of the argument prefix the
argument with 'ByValue'.
statements Program code
expression The value to return.
Examples
Function AddQuotes(str)
' Return the original string "surrounded with double quotes"
AddQuotes = Chr(34) & str & Chr(34)
End Function
Function DemoFunc(Arg1, ByRef Arg2)
' Return the two arguments in a single string
DemoFunc = "First: " & Arg1 & " second: " & Arg2
End Function