Solved

Comditional compilation for 64 bit

Posted on 2013-12-11
4
205 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
  • 2
  • 2
4 Comments
 
LVL 41

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 41

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now