Skip to main content

VBA Compiler constants

Visual Basic for Applications defines constants for exclusive use with the #If...Then...#Else directive. These constants are functionally equivalent to constants defined with the #If...Then...#Else directive except that they are global in scope; that is, they apply everywhere in a project.

On 16-bit development platforms, the compiler constants are defined as follows.

Constant Value Indicates that the development environment...
Win16 True Is 16-bit compatible.
Win32 False Is not 32-bit compatible.
Win64 False Is not 64-bit compatible.

On 32-bit development platforms, the compiler constants are defined as follows.

Constant Value Indicates that the development environment...
Vba6 True Is Visual Basic for Applications, version 6.0 compatible.
Vba6 False Is not Visual Basic for Applications, version 6.0 compatible.
Vba7 True Is Visual Basic for Applications, version 7.0 compatible.
Vba7 False Is not Visual Basic for Applications, version 7.0 compatible.
Win16 False Is not 16-bit compatible.
Win32 True Is 32-bit compatible.
Win64 False Is not 64-bit compatible.
Mac True Is Macintosh.
Mac False Is not Macintosh.

On 64-bit development platforms, the compiler constants are defined as follows.

Constant Value Indicates that the development environment...
Vba6 True Is Visual Basic for Applications, version 6.0 compatible.
Vba6 False Is not Visual Basic for Applications, version 6.0 compatible.
Vba7 True Is Visual Basic for Applications, version 7.0 compatible.
Vba7 False Is not Visual Basic for Applications, version 7.0 compatible.
Win16 False Is not 16-bit compatible.
Win32 True Is 32-bit compatible.
Win64 True Is 64-bit compatible.
Mac True Is Macintosh.
Mac False Is not Macintosh.

Leave a comment

Your email address will not be published. Required fields are marked *

Format your code: <pre><code class="language-vba">place your code here</code></pre>