• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 239
  • Last Modified:

Comditional compilation for 64 bit

This is a followup to my previous question http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/Q_28315813.html

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" ()
#Else
Public Declare PtrSafe Sub TentenInit Lib "lib1010vbasdk_32.dll" ()
#End If

Open in new window

0
leonstryker
Asked:
leonstryker
  • 2
  • 2
1 Solution
 
pcelbaCommented:
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...
0
 
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.
0
 
pcelbaCommented:
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. :-)
0
 
leonstrykerAuthor Commented:
Tried it before and it did not work, but this time I restarted Excel and it worked on both versions. Thank you :)
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now