Private statement
Define private variables and allocate storage space. Define a private variable in the Class block.
Private varname[([subscripts])][
, varname[([subscripts])]] . . .
Parameters
VarName
The name of the variable, followed by the standard variable naming convention.
subscripts
The number of dimensions of an array variable that can declare up to 60-d arrays. The subscripts parameter uses the following syntax:
Upper [, Upper] ...
The lower bound of an array is always 0.
Description
A Private statement variable can only be used in a script that declares the variable.
Before you use a variable that references an object, you must assign an existing object to the variable with the Set statement. The declared object variable is initialized empty before the assignment.
You can also declare a dynamic array with a Private statement with empty parentheses. After declaring a dynamic array, you can define the dimensions and elements of the array using the ReDim statement within the procedure. An error occurs if the array size is explicitly specified in Private, public, or Dim statements, but an attempt is made to declare the array dimension again.
Note When you use a private statement in a procedure, you usually place the private statement at the beginning of the procedure.
The following examples illustrate how to use Private statements:
Private MyNumber ' Private Variant variable.Private MyArray(9) ' Private array variable. ' Multiple Private declarations of Variant variables.Private MyNumber, MyVar, YourNumber