【问题标题】:How can I determine if my VB code is running on Office 2016 for Mac?如何确定我的 VB 代码是否在 Office 2016 for Mac 上运行?
【发布时间】:2015-06-22 21:20:15
【问题描述】:

我是否可以使用条件来区分我的宏是在 Office 2016 for Mac 还是 Office for Mac 2011 上运行

【问题讨论】:

    标签: excel vba macos ms-word powerpoint


    【解决方案1】:

    在 Office 2016 for Mac 中,有一个名为 MAC_OFFICE_VERSION 的新条件来测试用户正在运行的 VB 版本。 下面的例子展示了如何在你的代码中使用它:

    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
    

    注意:“#If Mac”条件在 Office for Mac 2011 中保持不变。

    【讨论】:

      猜你喜欢
      • 2021-06-01
      • 1970-01-01
      • 2018-11-29
      • 2016-11-01
      • 1970-01-01
      • 2017-07-24
      • 2012-02-22
      • 1970-01-01
      相关资源
      最近更新 更多