Sub 过程

Sub 过程是一系列执行操作但不返回值的 BSL 语句(由 Sub 和 End Sub 语句括起来)。Sub 过程可以接受参数(调用过程传递的常量、变量或表达式)。如果 Sub 过程没有参数,则其 Sub 语句必须包含一组空的括号 ()。

以下示例说明了 Sub 过程的用法:

示例

Sub CalculateArea()
    Dim length, width, area
    length = 5
    width = 4
    area = length * width   ' Calculates the area of the rectangle.
    'The area of the rectangle is 20
End Sub
Call CalculateArea()