CitectVBA Programming Reference > CitectVBA Function Reference > Declarations > Static

Static

The Static statement allocates storage for-and declares the data type of-variables and arrays that will retain their values between subsequent references. Static variables are more commonly used within procedures (subroutines and functions), and have local scope.

Syntax

Static VariableName[(Subscripts)] [As DataType]

VariableName:

The required name of the variable being declared (dimensioned).

Subscripts:

The optional subscript range for an array.

DataType:

The optional CitectVBA data type declaration for the variable.

Related Functions

Const | Dim | ReDim

Example

Static bytVar As Byte
Static binVar As Boolean
Static strVar As String
Static intVar As Integer
Static lngVar As Long
Static sngVar As Single
Static dblVar As Double
Static vntVar As Variant
Static objVar As Object
Static dtmVar As Date
Static udtVar As <UserDefinedTypeName>