Vbscript what is sub




















Default Used only with the Public keyword in a Class block to indicate that the Sub 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 Sub procedure is accessible only to other procedures in the script where it is declared. Commas separate multiple variables. The arglist argument has the following syntax and parts: [ByVal ByRef] varname [ ]. List of variables representing arguments that are passed to the Sub procedure when it is called. Commas separate multiple variables. If not explicitly specified using either Public or Private , Sub procedures are public by default, that is, they are visible to all other procedures in your script.

The value of local variables in a Sub procedure is not preserved between calls to the procedure. You can't define a Sub procedure inside any other procedure e.

Function or Property Get. The Exit Sub statement causes an immediate exit from a Sub procedure. Program execution continues with the statement that follows the statement that called the Sub procedure.

Any number of Exit Sub statements can appear anywhere in a Sub procedure. Like a Function procedure, a Sub procedure is a separate procedure that can take arguments, perform a series of statements, and change the value of its arguments. However, unlike a Function procedure, which returns a value, a Sub procedure can't be used in an expression. If used in a class definition, the sub procedure is also accessible from outside the class.

Public and Private are mutually exclusive. Indicates that a public procedure defined in a VBScript class that is, defined within a Class End Class construct is the default member of the class. Restricts the visibility of the sub procedure to those procedures within the same script.



0コメント

  • 1000 / 1000