Search notes:

VBA: vba6 and vba7 predefined compiler directive constants

The predefined compiler constants vba6 and vba7 allow to determine if a VBA environment is compatible to the VBA specification 6 or 7.
If vba7 is true, it implies that vba6 is also true.
option explicit

sub main() ' {

    #if vba6 then
        debug.print "vba6 is defined"
    #else
        debug.print "vba6 is not defined"
    #end if

    #if vba7 then
        debug.print "vba7 is defined"
    #else
        debug.print "vba7 is not defined"
    #end if

end sub ' }
Github repository about-VBA, path: /compiler-directives/vbaX/vba-version.bas
The vba7 constant is especially useful for the conditionally declaring functions with ptrSafe.

See also

Conditional compilation in VBA

Index