【发布时间】:2017-02-10 08:03:49
【问题描述】:
在我今天通过更新获得的 OSX 上新的 64 位 Excel 2016 版本中,在检查未定义 PtrSafe 的函数定义时似乎没有遵循条件编译(如32 位平台)。在这个例子中,我们对不同平台的同一个函数有不同的定义,当 Excel 加载加载项时,它会死掉并抱怨第三个定义在函数声明中没有 PtrSafe(但当然不是因为它适用于 32 位平台)。
有没有什么方法可以让 Excel 在 VBA 中遇到此代码时不会死机?或者这只是 OSX 上 64 位 Excel 2016 中的一个错误?对我来说似乎是一个明显的错误。我在哪里报告 Excel 中的错误?
#If Mac Then
' Even though the functions are exported with a leading underscore, Excel 2011 for Mac doesn't want the leading underscore as part of name
Private Declare PtrSafe Function get_global_param_string_private Lib "libCoolProp.dylib" Alias "get_global_param_string" (ByVal param As String, ByVal Output As String, ByVal n As Integer) As Long
#ElseIf Win64 Then
Private Declare PtrSafe Function get_global_param_string_private Lib "CoolProp_xls_x64.dll" Alias "get_global_param_string" (ByVal param As String, ByVal Output As String, ByVal n As Integer) As Long
#Else
Private Declare Function get_global_param_string_private Lib "CoolProp_xls_std.dll" Alias "_get_global_param_string@12" (ByVal param As String, ByVal Output As String, ByVal n As Integer) As Long
#End If
【问题讨论】:
标签: macos excel excel-2016 vba