Jim Dettman
jimdettman at verizon.net
Mon Jan 30 08:02:59 CST 2012
Your right, going back over this, it's confusing to say the least. I thought I understood it, but it looks like I got it screwed up (again :( ). If you read: http://msdn.microsoft.com/en-us/library/ee691831(office.14).aspx You'll see that: VBA7 Means simply Office 2010 VBA code base vs earlier versions. WIN64 means if *VBA* is running as 32 bit or 64 bit, not the OS! And you can see why this is confusing, because part of the answer is if you using the 64 bit version or not (which is the only one with the additional pointer types) and the way you code the declares. Also if there are two versions of the declare; one for 64 bit and one for 32 bits, or if they are both the same. Here's the example out of the article: #if Win64 then Declare PtrSafe Function MyMathFunc Lib "User32" (ByVal N As LongLong) As LongLong #else Declare Function MyMathFunc Lib "User32" (ByVal N As Long) As Long #end if This is an example of where the declare for 32 bit vs 64 is different. In the first declare, LongLong was used, so it's only valid under VBA in 64 bit mode, which implies VBA7 as well as the only VBA that has these new types is VBA7 64 bit (VBA7 32 bit does not have them). So I doing think there'd be any harm in doing: #if VBA7 and Win64 then as that would always be true anyway. The VBA7 is not needed though. In this one: #if VBA7 then Declare PtrSafe Sub MessageBeep Lib "User32" (ByVal N AS Long) #else Declare Sub MessageBeep Lib "User32" (ByVal N AS Long) #end if The declares are the same for 32 and 64 bits, but to operate correctly in 64 bits, you need to use the first declare. There's no need to use the Win64 constant, because it's the same call in either case, but you need to handle working in both 32 and 64 bit additions. I can see a lot of people getting goofed up over this. I suppose your best bet would be using the compatibility checker. Jim. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Mark Simms Sent: Monday, January 30, 2012 08:21 AM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Issues with running applications in 64 bit version ofOffice I've never seen VBA7 and WIN64 directives used together. So if VBA7 is true, do the API calls need to have Longs replaced by LongPtr for example ? Or only if WIN64 is true. I'm still confused....are there 4 combination of conditions to handle here ? Or only 2 ? or 3 ? VBA7 must be explicitly set to False in Excel 2003 ? #Const VBA7=False -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com