Public Statement

在模組級上 (而不是在子常式或函式中) 定義變數或陣列,從而使變數和陣列在所有的程式庫和模組中都有效。

語法


Public VarName[(start To end)] [As VarType][, VarName2[(start To end)] [As VarType][,...]]

示例:


Public iPublicVar As Integer
Sub ExamplePublic
    iPublicVar = iPublicVar + 1
    MsgBox iPublicVar
End Sub

Please support us!