Name
Sub Statement
Syntax
[Public [Default] | Private] Subname[(arglist)] [statements] [Exit Sub] [statements] End Sub
PublicUse: Optional
Type: Keyword
Gives the sub procedure visibility to all scripts. If used in a class definition, the sub procedure is also accessible from outside the class.
PublicandPrivateare mutually exclusive.DefaultUse: Optional
Type: Keyword
Indicates that a public procedure defined in a VBScript class (that is, defined within a
Class...End Classconstruct) is the default member of the class.PrivateUse: Optional
Type: Keyword
Restricts the visibility of the sub procedure to those procedures within the same script. In a class definition, restricts the visibility of the sub procedure to the class itself.
PublicandPrivateare mutually exclusive.nameUse: Required
The name of the sub procedure.
arglistUse: Optional
Data Type: Any
A comma-delimited list of variables to be passed to the sub procedure as arguments from the calling procedure.
statementsUse: Optional
Program code to be executed within the sub procedure.
arglistuses the following syntax and parts:[ByVal | ByRef]
varname[( )]ByValUse: Optional
The argument is passed by value; that is, a local copy of the variable is assigned the value of the argument.
ByRefUse: Optional
The argument is passed by reference; that is, the local variable is simply a reference to the argument being passed. All changes made to the local variable are also reflected in the calling argument.
ByRefis the default method of passing variables. ...
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