我在 VBA 中使用这个语句
Private Declare PtrSafe Function GetTimeZoneInformationAny Lib "kernel32" Alias _
"GetTimeZoneInformation" (buffer As Any) As Long
Run Code Online (Sandbox Code Playgroud)
这适用于:
但是我的客户报告了一个关于 word 的编译错误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
Run Code Online (Sandbox Code Playgroud)
这在 Excel 2010 64 位的第二行出现编译错误,该行保持红色,但是当我再次编译时,错误不再出现。这是 Excel 的行为方式吗?