将PtrSafe添加到vba函数调用到第三方dll中会导致64位Excel中的错误

时间:2019-02-22 19:40:44

标签: excel vba 64-bit

我有一个VBA项目,它可以对第3方dll进行3次调用,如下所示:

Private Declare Function cm_checkprotection Lib "ACPPYRAMID.DLL" Alias "CM_CheckProtection" (ByVal options As Long) As Long
Private Declare Function cm_getextendederror Lib "ACPPYRAMID.DLL" Alias "CM_GetExtendedError" (ByVal ExtErr As Any) As Long
Private Declare Function cm_getproductkeya Lib "ACPPYRAMID.DLL" Alias "CM_GetProductKeyA" (ByVal ProductKey As Any) As Long

我正在尝试将该项目移植到64位Excel中,但是当我在声明中添加“ PtrSafe”时,Excel栏出现“ Expected:Expression”错误,如下图所示。

64-bit Excel Error

有什么办法解决这个问题吗?

TIA,

坦率

1 个答案:

答案 0 :(得分:2)

将位置移至

Private Declare PtrSafe Function