
You should only use LongPtr for pointers or pointer-sized data types.
#Office 32bit 64bit license key#
You should not change it to LongPtr for the sake of it. Buy MS Office 2016 Professional Plus 32 Bit & 64 Bit - Original License Key by Post and E-mail + TPFNet Guide - Shipping Maximum 60min at a low price from. "Long exists in all versions and means the same thing in all versions (32-bit integer). It must be used for things that have the same size as a pointer."

"By adding PtrSafe to a function declaration, you promise to the compiler that you have put LongPtr in all places where it needs to be, and nowhere else." If you differentiate between versions via conditional compile constants, you have toĭo so with the referring variables within your own procedures, too. Hint: Take care to declare assigned API variables as well by the appropriate datatype.
#Office 32bit 64bit portable#
LongPtr enables writing portable code that can run in both 32-bit and 64-bit environments. Note that 64-bit systems can be installed either as 32-bit office or 64 bit office. LongPtr, however is not a true data type because it transforms to the right datatypeĭepending on the actual 32/64-bit environment. I mentioned already that frequently Office is installed as 32bit by default. Note that some API functions need to use also a conditional Win64 constant to identify actually installed 64bit Office systems Private Declare Function FindWindow Lib "User32" _ Private Declare PtrSafe Function FindWindow Lib "User32" Alias "FindWindowA" _ #End If), for instance #If VBA7 Then ' Office 2010 or higher

Just as little as you will be forced to do without Integer ( though btw internally VBA prefers Long integers).Īs a window handle is declared as LongPtr in Office 2010 or higherĪnd as Long in versions before, it was necessary to differentiate between the different versionsīy conditional compile constants ( #If VBA7 Then. My question is as follows: how it is possible that in excel365 I can still use normal Long variable?Ī VBA procedure, contrary to cited API functions isn't forced to "prohibit" a Long datatype for a variable, LongPtr types for for pointers to a → handle or → memory location (note the special PtrSafe prefix!). What you are probably referring to is that using API functions (API - Application Programming Interface) you have to I read that some macros might not work properly because of the Long variable declaration.
