Syntax 

Def{Bool|Cur|Date|Dbl|Int|Lng|Obj|Sng|Str|Var} _

    letterrange[, ...]


Group 

Declaration 


Description 

Define untyped variables as:


Parameters

Description

letterrange

letter, or letter-letter: A letter is one of A to Z. When letter-letter is used, the first letter must be alphabetically before the second letter. Variable names that begin with a letter in this range default to declared type.

If a variable name begins with a letter not in any letterrange then the variable is a Variant. The letterranges are not allowed to overlap.


See Also 

Option Explicit


Example

DefInt A,C-W,Y' integer

DefBool B     ' boolean

DefStr X      ' string

              ' all others are variant

 

Sub Main

    B = 1         ' B is an boolean

    Debug.Print B ' True

    X = "A"       ' X is a string

    Debug.Print X '"A"

    Z = 1         ' Z is a variant (anything)

    Debug.Print Z ' 1

    Z = "Z"

    Debug.Print Z '"Z"

End Sub