Microsoft Word Macros Mac
- Create Macros In Microsoft Word
- Microsoft Word Templates
- Microsoft Word Macros Examples
- Microsoft Word 2007 Macros
Create Macros In Microsoft Word
Use VBA add-ins and macros that you developed for Office for Windows with Office for Mac.
Applies to: Excel for Mac PowerPoint for Mac Word for Mac Office 2016 for Mac
To add a macro to the group, in the Choose commands from list, click Macros. Select the macro you want to add to your new group, and then click Add. The macro is added to the My Macros group. To use a friendlier name, click Rename, and then type the name you want in the Display name box.
If you are authoring Macros for Office for Mac, you can use most of the same objects that are available in VBA for Office. For information about VBA for Excel, PowerPoint, and Word, see the following:
- To run a macro, click the button on the Quick Access Toolbar, press the keyboard shortcut, or you can run the macro from the Macros list. Click View Macros View Macros. In the list under Macro name, click the macro you want to run.
- The Macro Virus Corrupts Data on both macOS and Windows The Microsoft Office products such as MS Word and Excel are known to use Macros to perform their routine functions on a computer system. A macro is a set of commands(instructions) that you can use to complete a task automatically within software such as MS Word/Excel.
Microsoft Word Templates
Note
Outlook for Mac and OneNote for Mac do not support VBA.
Office 2016 for Mac is sandboxed
Unlike other versions of Office apps that support VBA, Office 2016 for Mac apps are sandboxed.
Select one, or more, additional items, and then you should be able to continue.Arrange objects equal distances from each other.Select at least three objects that you want to arrange equal distances from each other. Vertical horizontal centering microsoft word for mac 2016. To more easily align objects, you can use a grid.
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
For instructions on creating an installer for your add-in, please refer to the article here: Installing User Content in Office 2016 for Mac
New VBA commands for Office 2016 for Mac
The following VBA commands are new and unique to Office 2016 for Mac.
Command | Use to |
---|---|
GrantAccessToMultipleFiles | Request a user's permission to access multiple files at once. |
AppleScriptTask | Call external AppleScript scripts from VB. |
MAC_OFFICE_VERSION | IFDEF between different Mac Office versions at compile time. |
Ribbon customization in Office for Mac
Office 2016 for Mac supports ribbon customization using Ribbon XML. Note that there are some differences in ribbon support in Office 2016 for Mac and Office for Windows.
Ribbon customization feature | Office for Windows | Office for Mac |
---|---|---|
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 |
Ability to include and invoke Office Fluent Controls within a custom ribbon tab | Available | Most familiar Office Fluent Control Identifiers are compatible with Office for Mac. Some might not be available. For commands that are compatible with Office 2016 for Mac, see idMSOs compatible with Office 2016 for Mac. |
Support for COM add-ins that use custom ribbon controls | Available | Office 2016 for Mac doesn't support third-party COM add-ins. |
idMSOs compatible with Office 2016 for Mac
For information about the idMSOs that are compatible with Office 2016 for Mac, see the following:
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
Today’s guest writer is Kerry Westphal—our resident macro expert.
A common feature in well-designed applications is giving users the ability to quickly focus on the data they care about. A search or filter form allows users to specify criteria to limit the records returned. This also enhances performance because the entire recordset is not brought in.
A typical filter form provides unbound text boxes, combo boxes, and other controls where users can build and refine requirements for records to meet in order to be displayed on the form. Allen Browne has a great VBA example here where he uses a filter form to search for clients by name, type, city, level and/or start and end dates. In Allen’s example, the form Filter property is set to a string that is built based on user criteria, and the FilterOn action is invoked.
Microsoft Word Macros Examples
To accomplish the same goals using macros that run on the Web, let’s walk through an example together. This demonstrates using the BrowseTo action to swap out the subform, TempVars are used to store form criteria and If statements decide which criteria is relevant.

For tracking issues that arise at work, I have a database where I filter issues by words in the summary, person it is assigned to, and the state of their resolution. When I first browse to the form, instead of showing data, the subform is populated with a form which displays a message that says “Select a filter using the Summary, Assigned To and Resolution fields to view the open issues.â€

The On Click event of the search button calls the BrowseTo macro action, which replaces the Issues datasheet contained by the subform with only showing only data that meets the specified criteria.
In the example above, I have specified criteria to limit issues displayed to those with “macro†in the Summary that have been assigned to Kerry Westphal. When I click the search button my macro will run and the filtered records will show.
Before we consider all the criteria, let’s construct a simple macro that considers only the Summary criteria textbox (txtSummary). Once our macro is working, we will add in more logic.
The first thing we will do in the macro is set up the error handler using the OnError action to specify a Submacro named ErrorHandler to be called in case there is an error message to display. Next we will use SetTempVar to assign the value contained by the txtSummary control to a TempVar. If the txtSummary control contains a value, the Like operator is used with wildcards in the Where Condition argument of the BrowseTo action to show the proper records. Otherwise, the BrowseTo action will show all the records. More information about the BrowseTo action can be found here
You can grab the XML here (Note: to copy this XML to paste into the macro designer, use Page->View Source and copy the XML from there).
Now that our basic macro is tested (I did that for us and it works J), we will add another condition to see only the issues assigned to the person selected in the dropdown. We can use the same logic to filter on the Assigned To field that we used for filtering on the Summary field.
In our assignments section at the top of the macro, we will add another SetTempVar action to store the AssignedTo criteria on the form.
- If the AssignedTo criteria is not filled out, the logic we built above to consider Summary criteria for BrowseTo will be executed.
- If AssignedTo critieria is filled out but the Summary criteria is not, only AssignedTo will be considered in the BrowseTo Where Condition.
- If both AssignedTo and Summary criteria are specified, the Where Condition of BrowseTo concatenates them both.
Get the XML here.
We can do a similar check for Resolution criteria. This can continue for as many fields as we want to validate in our filter form to show as many or few records as needed. The macro is below and you can grab the XML for the entire macro here.
Microsoft Word 2007 Macros
What macros have you been making?