Using Type Declaration Characters

If you don't declare a variable with a Dim statement, you can still designate a type for it by using a special character at the end of the variable name. For example, to declare the FirstName variable as String, you append the dollar sign to the variable name as shown:

Dim FirstName$

The above is the same as Dim FirstName As String. Other type declaration characters are shown in Table 3-2.

Notice that the type declaration characters can only be used with six data types. To use the type declaration character, append the character to the end of the variable name.

Table 3-2: Type declaration characters

Data Type

Character

Integer

%%

Long

&

Single

!

Double

#

Currency

@

String

$

0 0

Post a comment