How can I determine if my VB code is running on Of

2019-05-18 05:02发布

Is there a conditional that I can use to differentiate if my Macro is running on Office 2016 for Mac or Office for Mac 2011

1条回答
【Aperson】
2楼-- · 2019-05-18 05:42

In Office 2016 for Mac, there is a new conditional called MAC_OFFICE_VERSION to test which VB version the user is running. The following example shows how it to use it in your code:

Sub VersionConditionals()
#If MAC_OFFICE_VERSION >= 15 Then
    Debug.Print "We are running on Mac 15+"
#Else
    Debug.Print "We are not running on Mac 15+"
#End If
#If Mac Then
    Debug.Print "We are running on a Mac"
#Else
    Debug.Print "We are not running on a Mac"
#End If
End Sub

Note: The "#If Mac" conditional remains unchanged from Office for Mac 2011.

查看更多
登录 后发表回答