Mac 64位编译器常量

时间:2016-10-02 03:15:35

标签: macos excel-vba vba excel

微软刚刚在OSX上将Excel 2016更新为64位(是的!)。但现在他们已经打破了OSX的加载支持。第一个问题:

问:如何在Excel 2016 for OSX上有条件地编译/包含代码?在Windows上,它们具有32位和64位的独立标志,因此您可以执行以下操作:

#If 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

但根据https://msdn.microsoft.com/en-us/library/office/gg264614.aspx,没有单独的VBA常量来区分OSX上的位数?他们添加了哪些编译器常量?

1 个答案:

答案 0 :(得分:3)

使用条件,如下:

#If Win64 Then

#ElseIf Win32 Then

#ElseIf Mac Then
    #If MAC_OFFICE_VERSION >= 15 Then
        #If VBA7 Then ' 64-bit Excel 2016 for Mac

        #Else ' 32-bit Excel 2016 for Mac

        #End If
    #Else ' 32-bit Excel 2011 for Mac

    #End If
#End If