2016-10-02 93 views
1

微軟剛剛在OSX上更新了Excel 2016(64位)(yay!)。但是現在他們已經破壞了OSX上的插件支持。第一個問題:Mac 64位編譯器常量

問:我如何有條件地編譯/包含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 "[email protected]" (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位數來區分?他們添加了什麼編譯器常量?

回答

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 
+0

尼斯!任何想法在我的其他非常相關的問題:http://stackoverflow.com/questions/39813612/excel-2016-conditional-compilation-with-32-bit-flags? – ibell

+0

參見https://github.com/OfficeDev/VBA-content/blob/master/VBA/Office-Mac-VBA/MacOfficeVersion.md – ibell