Skip to Main Content
VBScript in a Nutshell, 2nd Edition
book

VBScript in a Nutshell, 2nd Edition

by Paul Lomax, Matt Childs, Ron Petrusha
March 2003
Intermediate to advanced content levelIntermediate to advanced
512 pages
14h 30m
English
O'Reilly Media, Inc.
Content preview from VBScript in a Nutshell, 2nd Edition

Name

Private Statement

Syntax

Private varname[([subscripts])] [, varname[([subscripts])] . . .
varname

Use: Required

Variant Type: Any

The name of the variable, following Visual Basic naming conventions.

subscripts

Use: Optional

Variant Type: Integer or Long

Denotes varname as 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 Private variable’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, the Private keyword generates an error.

  • varname follows 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 subscripts argument 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 ...

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.
Start your free trial

You might also like

VBScript in a Nutshell

VBScript in a Nutshell

Matt Childs, Paul Lomax, Ron Petrusha
Microsoft® PowerShell, VBScript and JScript® Bible

Microsoft® PowerShell, VBScript and JScript® Bible

William R. Stanek, James O'Neill, Jeffrey Rosen

Publisher Resources

ISBN: 0596004885Errata Page