Create or run a macro (2024)

Word for Microsoft 365 Word for the web Word 2021 Word 2019 Word 2016 Word 2013 More...Less

In Word, you can automate frequently used tasks by creating and running macros. A macro is a series of commands and instructions that you group together as a single command to accomplish a task automatically.

Newer versionsWeb

To save time on tasks you do often, bundle the steps into a macro. First, you record the macro. Then you can run the macro by clicking a button on the Quick Access Toolbar or pressing a combination of keys. It depends on how you set it up.

  1. Click View > Macros > Record Macro.

    Create or run a macro (1)

  2. Type a name for the macro.

    Create or run a macro (2)

  3. To use this macro in any new documents you make, be sure the Store macro in box says All Documents (Normal.dotm).

    Create or run a macro (3)

  4. To run your macro when you click a button, click Button.

    Create or run a macro (4)

  5. Click the new macro (it’s named something like Normal.NewMacros.<your macro name>), and click Add.

    Create or run a macro (5)

  6. Click Modify.

    Create or run a macro (6)

  7. Choose a button image, type the name you want, and click OK twice.

    Create or run a macro (7)

  8. Now it’s time to record the steps. Click the commands or press the keys for each step in the task. Word records your clicks and keystrokes.

    Note:Use the keyboard to select text while you’re recording your macro. Macros don’t record selections made with a mouse.

  9. To stop recording, click View > Macros > Stop Recording.

    Create or run a macro (8)

The button for your macro appears on the Quick Access Toolbar.

Create or run a macro (9)

To run the macro, click the button.

  1. Click View > Macros > Record Macro.

    Create or run a macro (10)

  2. Type a name for the macro.

    Create or run a macro (11)

  3. To use this macro in any new documents you make, be sure the Store macro in box says All Documents (Normal.dotm).

    Create or run a macro (12)

  4. To run your macro when you press a keyboard shortcut, click Keyboard.

    Create or run a macro (13)

  5. Type a combination of keys in the Press new shortcut key box.

  6. Check to see whether that combination’s already assigned to something else. If it's already assigned, try a different combination.

  7. To use this keyboard shortcut in any new documents you make, be sure the Save changes in box says Normal.dotm.

  8. Click Assign.

  9. Now it’s time to record the steps. Click the commands or press the keys for each step in the task. Word records your clicks and keystrokes.

    Note:Use the keyboard to select text while you’re recording your macro. Macros don’t record selections made with a mouse.

  10. To stop recording, click View > Macros > Stop Recording.

    Create or run a macro (14)

To run the macro, press the keyboard shortcut keys.

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.

  1. Click View > Macros > View Macros.

    Create or run a macro (15)

  2. In the list under Macro name, click the macro you want to run.

  3. Click Run.

To make a macro from one document available in all new documents, add it to the Normal.dotm template.

  1. Open the document that contains the macro.

  2. Click View > Macros > View Macros.

    Create or run a macro (16)

  3. Click Organizer.

    Create or run a macro (17)

  4. Click the macro you want to add to the Normal.dotm template, and click Copy.

  1. Click File > Options > Customize Ribbon.

  2. Under Choose commands from, click Macros.

  3. Click the macro you want.

  4. Under Customize the ribbon, click the tab and custom group where you want to add the macro.

If you don't have a custom group, click New Group. Then click Rename and type a name for your custom group.

  1. Click Add.

  2. Click Rename to choose an image for the macro and type the name you want.

  3. Click OK twice.

  1. On the Developer tab, in the Code group, click Macros.

  2. In the Macro name box, type a name for the macro.

    Note:If you give a new macro the same name as a built-in macro in Word, the new macro actions will replace the built-in macro. To view a list of built-in macros, click Word Commands in the Macros in list.

  3. In the Macros in list, click the template or document in which you want to store the macro.

    To make your macro available in all documents, be sure to click Normal.dotm.

  4. Click Create to open the Visual Basic Editor.

After you open the Visual Basic Editor, you may want more information about working with Visual Basic for Applications. For more information, click Microsoft Visual Basic Help on the Help menu or press F1.

To make quick work of tasks that you do often, in the desktop version of Word you can bundle the steps into macros that run with a single click. In Word for the web, you have to step through such tasks manually.

If you have Word, first click Open in Word to open your document in Word.

Create or run a macro (18)

Then follow the instructions for the desktop version of Word.

When you run the macro in Word and save the document, you’ll see the results of the macro when you reopen your doc in Word for the web.

Need more help?

Want more options?

Discover Community

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Create or run a macro (19)

Microsoft 365 subscription benefits

Create or run a macro (20)

Microsoft 365 training

Create or run a macro (21)

Microsoft security

Create or run a macro (22)

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Create or run a macro (23)

Ask the Microsoft Community

Create or run a macro (24)

Microsoft Tech Community

Create or run a macro (2024)

FAQs

What is the benefit of macros How will you create and run a macro in a spreadsheet application? ›

If you have tasks in Microsoft Excel that you do repeatedly, you can record a macro to automate those tasks. A macro is an action or a set of actions that you can run as many times as you want. When you create a macro, you are recording your mouse clicks and keystrokes.

What is an example of a macro in Word? ›

Basically, macros are used to do any repetitive job. For example, when I was writing my books I kept each chapter in a separate document and then used a macro to join them all together and update the tables of contents and figures. I also used a macro to add selected words to the index (in a separate file).

How do I run a macro step by step? ›

Select the macro you want to run, by placing your cursor anywhere within the macro, and press F5, or on the menu, go to Run > Run Macro.

Why is it important to create and run macros? ›

A macro is typically a series of commands or instructions that are combined to form a single command. Macros can save you time by letting you automate relatively simple tasks that you need to perform often, as well as complex procedures that consist of many steps.

What are three benefits to creating and using macros? ›

Macros are a sequence of commands or actions compiled into a single script that automates repetitive tasks across various software products. This functionality streamlines workflows, enhances productivity, and reduces the potential for human error across multiple applications.

What is the benefit of creating macros? ›

Compared to a human operator, a macro interacts with a host application more quickly and with a smaller risk of error. A macro does not require that the person who runs it be trained in operating the host application.

What is macro in Excel with example? ›

Macros in Excel are like recorded sequences of actions that automate tasks. They save time and minimize mistakes by letting you repeat actions with a single click. VBA, or Visual Basic for Applications, is a programming language in Excel. It allows you to write custom code to create advanced and personalized macros.

What are the two ways of creating a macro in Excel? ›

There are two ways to create a macro: by recording them or by writing them in Excel's Visual Basic programming language. This lesson explains the easy way to create a macro—by recording the task(s) you want the macro to execute for you.

What is the macro key for Excel? ›

In the Developer tab, click Macros to view macros associated to a workbook. Or press Alt+ F8. This opens the Macro dialog box.

What is the purpose of saving a macro to your personal macro workbook? ›

If you find yourself recreating the same macros, you can copy those macros to a special workbook called Personal. xlsb that is saved on your computer. Any macros that you store in your personal workbook become available to you whenever you start Excel on that same computer.

What are two examples of macro in computer? ›

A macro records operations and re-uses the sequence of mouse actions or keystrokes of anything you can do in Excel with keystrokes or a mouse. Some of those actions include; cleaning up data, formatting cells, creating tables or organizing data in an Excel spreadsheet.

Which one is the most suitable reason to use macro in MS Office? ›

The main reason for creating a macro in these two MS Office products is to automate repetitive tasks. Knowledge of VBA programming is required to make use of this function in an advanced way.

How do I automatically run a macro in Excel? ›

Click Developer > Record Macro. In the Macro name box, type Auto_Open. In the Store macro in box, pick Personal Macro Workbook. This will make the macro available every time you open Excel.

Top Articles
Latest Posts
Article information

Author: Foster Heidenreich CPA

Last Updated:

Views: 6315

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Foster Heidenreich CPA

Birthday: 1995-01-14

Address: 55021 Usha Garden, North Larisa, DE 19209

Phone: +6812240846623

Job: Corporate Healthcare Strategist

Hobby: Singing, Listening to music, Rafting, LARPing, Gardening, Quilting, Rappelling

Introduction: My name is Foster Heidenreich CPA, I am a delightful, quaint, glorious, quaint, faithful, enchanting, fine person who loves writing and wants to share my knowledge and understanding with you.