Quote Originally Posted by Bob Phillips View Post
That would suggest that we should just declare every long as LongPtr, 23bit or 64bit, and the conditional code is only necessary for PtrSafe? Might explain why it works when I have declared a non-handle variable as LongPtr.
The conditional compilation for VBA7 is necessary for LongPtr and PtrSafe because these keywords only exist in VBA7.

As for "just declare every long as LongPtr", you will get away with declaring most Long variables as LongPtr but not all of them.
If you are interested in the details, I recommend my text Windows API declarations in VBA for 64-bit. (It mentions Microsoft Access in some locations, but the same is also true Excel, Word, and any other VBA enabled application.)