Text Documents (Writer)
HTML Documents (Writer Web)
Spreadsheets (Calc)
Presentations (Impress)
Drawings (Draw)
Database Functionality (Base)
Formulae (Math)
Charts and Diagrams
Macros and Scripting
Office Installation
Common Help Topics
OneOffice Logo

Public Statement

Dimensions a variable or an array at the module level (that is, not within a subroutine or function), so that the variable and the array are valid in all libraries and modules.

Syntax:


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

Example:


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