Sub Statement

  1. Sub SubName [(arguments)]

    1. Dim [variable(s)]

      [statementblock]

      [Exit Function]

    End Sub

Declares and defines a Sub procedures name, 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 andByVal" in this manual). The optional As type parameter is used to specify the data type. Valid types are String, Integer, Double, Long, and Varaint (see "Variable Types" in this manual).

Related Topics: Call, Dim, Function

Example: