Solved

Comditional compilation for 64 bit

Posted on 2013-12-11
4
225 Views
Last Modified: 2013-12-11
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
Comment
Question by:leonstryker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 42

Expert Comment

by:pcelba
ID: 39712387
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
 
LVL 29

Author Comment

by:leonstryker
ID: 39712420
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
 
LVL 42

Accepted Solution

by:
pcelba earned 500 total points
ID: 39712440
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
 
LVL 29

Author Closing Comment

by:leonstryker
ID: 39712452
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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a serious pitfall that can happen when deleting shapes using VBA.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question