Name
Private Statement
Syntax
Privatevarname[([subscripts])] [,varname[([subscripts])] . ..
-
varname Use: Required
Variant Subtype: Any
The name of the variable, following Visual Basic naming conventions.
-
subscripts Use: Optional
Variant Subtype: 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 or local variable and allocate the relevant storage space in memory.
Rules at a Glance
A
Privatevariable’s scope is limited to the script in which it’s created for script-level 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.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 and whose upper bound is 10). Similarly:
Private lngPrices(10, 10)
defines a two-dimensional array of eleven elements in each dimension.
Using the
subscriptsargument, you can declare up to 60 multiple dimensions for the array.If the
subscriptsargument isn’t used (i.e., the variable name is followed by empty parentheses), the array is declared dynamic. You ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access