#Const (directive)

Syntax

#Const constname = expression

Description

Defines a preprocessor constant for use in the #If...Then...#Else statement.

Comments

Internally, all preprocessor constants are of type Variant. Thus, the expression parameter can be any type.

Variables defined using #Const can only be used within the #If...Then...#Else statement and other #Const statements. Use the Const statement to define constants that can be used within your code.

Example

#Const SUBPLATFORM = "XP"
#Const MANUFACTURER = "Windows"
#Const TYPE = "Workstation"
#Const PLATFORM = MANUFACTURER & " " & SUBPLATFORM & " " & TYPE
Sub Main()
   #If PLATFORM = "Windows XP Workstation" Then
     MsgBox "Running under Windows XP Workstation"
   #End If

End Sub

See Also

#If...Then...#Else (directive)

More information

Symbols