basCryptoSys.bas
.
To use the VBA functions in this API with a 64-bit version of Microsoft Office you need to use the "PtrSafe" attribute in a declaration statement as in this example:
Public Declare Function API_Version Lib "diCryptoSys.dll" () As Long ' Original 32-BIT
Public Declare PtrSafe Function API_Version Lib "diCryptoSys.dll" () As Long ' New 64-BIT
That is, add the keyword PtrSafe
between Public Declare
and Function
.
There are no other changes to make.
You can use the VBA7 conditional compilation constant, if you wish. For example.
#If VBA7 Then Public Declare PtrSafe Function API_Version Lib "diCryptoSys.dll" () As Long #Else Public Declare Function API_Version Lib "diCryptoSys.dll" () As Long #End If
This is what we now do. In some IDEs, like the old VB6, one set may appear red. It's unsightly, but does not prevent compilation.
AFAWK there is no need to use the Win64 constant.
You do not change any types to LongLong
or LongPtr
.
For more information, see the Microsoft Developer Network page Compatibility Between the 32-bit and 64-bit Versions of Office 2010.