Comditional compilation for 64 bit

This is a followup to my previous question

Apparently the compilation constant (VBA7) is not working for me as the the branching is always directed to the true part of the statement:
#If VBA7 Then
Public Declare PtrSafe Sub TentenInit Lib "lib1010vbasdk_64.dll" ()
Public Declare PtrSafe Sub TentenInit Lib "lib1010vbasdk_32.dll" ()
#End If

Open in new window

LVL 29
Who is Participating?
pcelbaConnect With a Mentor Commented:
Yes but the Win64 constant does not point to Windows 64. It  should distinguish between Office 32/64 bit

A small typo fix:  You CAN install 64 bit office on a 64 bit Windows. :-)
Did you try Win64 instead of VBA7 ?  Win64 should distinguish between Office 32/64. VBA7 distinguishes between 2010 and earlier versions.

But I am a little bit skeptic if the following paragraph is true:
Compile time constants should be evaluated during the compile time so the result depends on the environment used during compilation and you cannot affect the program behavior at run-time this way...
leonstrykerAuthor Commented:
Well, the Windows version will always be 64, since you can install either 32 or 64 bit Office on that, and you can not install 64 bit office on a 64 bit Windows.
leonstrykerAuthor Commented:
Tried it before and it did not work, but this time I restarted Excel and it worked on both versions. Thank you :)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.