在Excel中声明PtrSafe兼容性 [英] Declare PtrSafe Compatibility in Excel
本文介绍了在Excel中声明PtrSafe兼容性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在VBA中使用此语句
I am using this statement in 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.
However my client reported a compile error on the word PtrSafe
. He is using Excel 2010.
我不确定为什么会这样.有什么想法吗?
I am not sure why this happens. any ideas?
推荐答案
好,我已将其重写为:
#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
这在64位Excel 2010的第二行中给出了编译错误,并且该行保持为红色,但是当我再次编译时,该错误不再显示.这是Excel的行为方式吗?
This gave a compile error on the second line in Excel 2010 64-bit and the line remained colored red but when I compile again the error doesn't show up anymore. Is this how Excel behaves?
这篇关于在Excel中声明PtrSafe兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文