Name
Private Statement
Syntax
Privatevarname[([subscripts])] [,varname[([subscripts])] . ..
varnameUse: Required
Variant Type: Any
The name of the variable, following Visual Basic naming conventions.
subscriptsUse: Optional
Variant Type: Integer or Long
Denotes
varnameas an array and optionally specifies the number and extent of array dimensions.
Description
Used in a script or in a class to declare a private variable and allocate the relevant storage space in memory.
Rules at a Glance
A
Privatevariable’s visibility is limited to the script in which it’s created for global variables and to the class in which it is declared for class-level variables. Elsewhere, thePrivatekeyword generates an error.varnamefollows standard VB naming conventions. It must begin with an alphabetic character, can’t contain embedded periods or spaces, can’t be the same as a VBScript reserved word, must be shorter than 255 characters, and must be unique within its scope.You can override standard variable naming conventions by placing your variable name in brackets. This allows you to use reserved words or illegal characters in variable names. For example:
Private [me] Private [1Var] Private [2-Var]
The
subscriptsargument has the following syntax:upperbound[,upperbound]...For example:
Private strNames(10)
defines an array of 11 elements (an array whose lower bound is 0 and whose upper bound is 10). Similarly:
Private lngPrices(10, 10)
defines a two-dimensional array of eleven elements in each dimension.
Using the ...