Storing Program Data
A variable is a place where your program can store data while it is running. As the name implies, the data in a variable can change as often as needed. VBA provides a complete set of different types of variables suited for different kinds of data. Let's look first at naming and declaring variables, then we will examine the different variable types.
Naming and Declaring Variables
Each variable in a program needs its own unique name. (See the section on variable scope later in this chapter.) You can name a variable pretty much anything you like as long as you follow these rules:
Do not use one of VBA's keywords.
The maximum length is 255 characters.
The first character must be a letter.
The name cannot contain a period, space, ...
Get Office® XP Development with VBA now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.