VBA代码64位系统

时间:2014-10-05 02:13:36

标签: excel-vba vba excel

我收到一条错误,我的代码需要为Office 64位系统更新。我无法理解需要进行哪些更改,因为这在Office 32位上运行良好。

Private Declare Function GetTimeZoneInformationAny Lib "kernel32" Alias _
  "GetTimeZoneInformation" (buffer As Any) As Long

2 个答案:

答案 0 :(得分:2)

我已阅读所提供的指南。我认为像这样声明PtrSafe应该这样做吗?

Private Declare PtrSafe Function GetTimeZoneInformationAny Lib "kernel32" Alias _
  "GetTimeZoneInformation" (buffer As Any) As Long

答案 1 :(得分:-1)

32位系统和64位功能中的Windows API函数不同。

请尝试使用以下代码。

#If Win64 Then
    Private Declare Function GetTimeZoneInformationAny64 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位模式下编译的话,Win64会被解除,否则它不会被删除。

通过使用Win64确定系统是64位还是32位,您可以使用适合您办公系统的功能。

相关问题