Office for MacOffice for Mac

使用为 Office for Windows 开发的 VBA 加载项和宏Office for Mac。Use VBA add-ins and macros that you developed for Office for Windows with Office for Mac.

适用于: Excel for Mac |PowerPoint for Mac |Word for Mac |Office 2016 for MacApplies to: Excel for Mac | PowerPoint for Mac | Word for Mac | Office 2016 for Mac

如果要创作宏Office for Mac,可以使用 VBA for Office 中的大部分相同对象。If you are authoring Macros for Office for Mac, you can use most of the same objects that are available in VBA for Office. 有关适用于 Excel、PowerPoint 和 Word 的 VBA 的信息,请参阅以下内容:For information about VBA for Excel, PowerPoint, and Word, see the following:

备注

Outlook for Mac 和 OneNote for Mac 不支持 VBA。Outlook for Mac and OneNote for Mac do not support VBA.

Office 2016 for Mac 已沙盒Office 2016 for Mac is sandboxed

与其他支持 VBA 的 Office 应用版本不同,Office 2016 for Mac 应用是沙盒应用。Unlike other versions of Office apps that support VBA, Office 2016 for Mac apps are sandboxed.

沙盒限制应用访问应用容器外部的资源。Sandboxing restricts the apps from accessing resources outside the app container. 这会影响涉及文件访问或进程间通信的任何加载项或宏。This affects any add-ins or macros that involve file access or communication across processes. 您可以使用下一节中介绍的新命令最大程度地降低沙盒的影响。You can minimize the effects of sandboxing by using the new commands described in the following section.

创建安装程序或放置用户内容Creating an installer or putting user content

有关为外接程序创建安装程序的说明,请参阅以下文章:在 Office 2016 for Mac中安装用户内容For instructions on creating an installer for your add-in, please refer to the article here: Installing User Content in Office 2016 for Mac

Office 2016 for Mac 的新 VBA 命令New VBA commands for Office 2016 for Mac

以下 VBA 命令是 Office 2016 for Mac 的新增命令且是唯一的。The following VBA commands are new and unique to Office 2016 for Mac.

命令Command 用于Use to
GrantAccessToMultipleFilesGrantAccessToMultipleFiles 请求用户同时访问多个文件的权限。Request a user's permission to access multiple files at once.
AppleScriptTaskAppleScriptTask 从外部服务器调用外部 AppleScript VB。Call external AppleScript scripts from VB.
MAC_OFFICE_VERSIONMAC_OFFICE_VERSION 编译时不同 Mac Office 版本之间的 IFDEF。IFDEF between different Mac Office versions at compile time.

功能区自定义Office for MacRibbon customization in Office for Mac

Office 2016 for Mac 支持使用功能区 XML 进行功能区自定义。Office 2016 for Mac supports ribbon customization using Ribbon XML. 请注意,Office 2016 for Mac 和 Office for Windows 的功能区支持存在一些差异。Note that there are some differences in ribbon support in Office 2016 for Mac and Office for Windows.

功能区自定义功能Ribbon customization feature Office for WindowsOffice for Windows Office for MacOffice for Mac
使用功能区 XML 自定义功能区的功能Ability to customize the ribbon using Ribbon XML 可用Available 可用Available
支持基于文档的加载项Support for document based add-ins 可用Available 可用Available
使用自定义功能区控件调用宏的功能Ability to invoke Macros using custom ribbon controls 可用Available 可用Available
自定义菜单Customization of custom menus 可用Available 可用Available
能够在自定义功能区选项卡中包括和调用 Office Fluent 控件Ability to include and invoke Office Fluent Controls within a custom ribbon tab 可用Available 最熟悉的 Office Fluent 控件标识符与Office for Mac。Most familiar Office Fluent Control Identifiers are compatible with Office for Mac. 其中一些可能不可用。Some might not be available. 有关与 Office 2016 for Mac 兼容的命令,请参阅与 Office 2016 for Mac 兼容的 idMSOs。For commands that are compatible with Office 2016 for Mac, see idMSOs compatible with Office 2016 for Mac.
支持使用自定义功能区控件的 COM 加载项Support for COM add-ins that use custom ribbon controls 可用Available Office 2016 for Mac 不支持第三方 COM 加载项。Office 2016 for Mac doesn't support third-party COM add-ins.

与 Office 2016 for Mac 兼容的 idMSOsidMSOs compatible with Office 2016 for Mac

有关与 Office 2016 for Mac 兼容的 idMSOs 的信息,请参阅以下内容:For information about the idMSOs that are compatible with Office 2016 for Mac, see the following:

另请参阅See also

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.