Dim varname[([subscripts])] [As [New] type] [, varname[([subscripts])] [As [New] type]] . . .
Your chosen name for the variable.
Dimensions of an array variable.
Keyword that creates an instance of an object.
The data type of varname.
Declares and allocates storage space in memory for variables. The Dim statement is used either at the start of a procedure or the start of a module to declare a variable of a particular data type.
In addition to the Visual Basic data types listed in Chapter 3, type can be an Object, an object type, or a user-defined type. The default data type, when no type is explicitly declared, is Variant.
Variable-length strings are declared using the syntax:
Dim variablename As String
Fixed-length strings, on the other hand, are declared using the syntax:
Dim variablename As String * length
You can declare multiple variables in a single Dim statement, but each variable you declare must use a separate As type clause.
Variables have the following values when they are first initialized with the Dim statement:
|Data Type||Initial Value|
|Variable-length string||Zero-length string ("")|
|Fixed-length string||Padded with zeros|
To use an object variable that has not been declared using the New keyword, the Set statement must assign an object to the variable before it can be used, as ...