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

Global keyword

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

Syntax:


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

Example:


Global iGlobalVar As Integer
Sub ExampleGlobal
    iGlobalVar = iGlobalVar + 1
    MsgBox iGlobalVar
End Sub