Sub Statement

  1. Sub SubName [(arguments)]

    1. Dim [variable(s)]

      [statementblock]

      [Exit Function]

    End Sub

Declares and defines a Sub procedure name, its parameters and code.

When the optional argument list needs to be passed the format is as follows:

  1. ([ByVal] variable [As type] [,ByVal] variable [As type] ]…])

The optional ByVal parameter specifies that the variable is passed by value instead of by reference (see ByRef and ByVal" in this manual). The optional As type parameter is used to specify the data type. Valid types are String, Integer, Double, Long, and Variant (see "Variable Types" in this manual).

Related Topics:

Call

Dim

Function

More:

Example - Sub Statement