我在 VBA 中使用此语句
Private Declare PtrSafe Function GetTimeZoneInformationAny Lib "kernel32" Alias _
"GetTimeZoneInformation" (buffer As Any) As Long
这适用于:
- Win 64 位、Excel 2010 64 位
- Win 64 位、Excel 1010 32 位
但是我的客户报告了单词 PtrSafe
的编译错误。他正在使用 Excel 2010。
我不知道为什么会发生这种情况。有什么想法吗?
最佳答案
好的,我已经重写了这个:
#If VBA7 Then
Private Declare PtrSafe Function GetTimeZoneInformationAny Lib "kernel32" Alias "GetTimeZoneInformation" (buffer As Any) As Long
#Else
Private Declare Function GetTimeZoneInformationAny Lib "kernel32" Alias "GetTimeZoneInformation" (buffer As Any) As Long
#End If
这在 Excel 2010 64 位中的第二行上出现了编译错误,并且该行保持红色,但当我再次编译时,错误不再显示。这是 Excel 的行为方式吗?
关于excel - 在 Excel 中声明 PtrSafe 兼容性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26822004/