Matus
Matus

Reputation: 181

32bit vs 64bit Office - Ptrsafe function delcaration - when can I use it

We are moving from 32-bit to 64-bit Office products. This means that some of the VBA code throws errors if the function is not declared PtrSafe. I understand that I can use Ptrsafe in combination with #If VBA7...

My question is, can I declare all functions PtrSafe or there are functions that would not work or cause error?

Thank you for your response, have a nice day

Upvotes: 0

Views: 1030

Answers (1)

GSerg
GSerg

Reputation: 78185

PtrSafe does not introduce any functionality. You cannot therefore say that something will or will not without it.

PtrSafe is a flag with which you tell to the compiler, "I have verified that types I used for this API declaration are correct regardless of the pointer size".

If you have verified that the types you are using are correct, put the PtrSafe. If you haven't, don't put it (and then it will not compile when there is a possibility of an error, that is, when the pointer size is not 32 bits).

Upvotes: 1

Related Questions