Home >Common Problem >How to Create a Macro in Powerpoint Step by Step
A macro is simply a set of instructions written by the user and saved under the macro name. When a macro name is called in a presentation, it automatically executes the set of instructions defined under the macro name. Macros are embedded into PowerPoint presentations when needed. You can use VBA to code macros in PowerPoint. It helps us create our own designs and reuse them. Macros can also be created in other Microsoft Office applications. Let’s see how to create a simple macro in PowerPoint
Step 1. Open PowerPoint. Type PowerPoint in the search space in the lower left corner. You can open PowerPoint with just one click.
Step 2. Double-click PowerPoint. After opening click on File
Step 3: Search for Options and click on it
Step 4: Click Customize Ribbon. On the right side of the window, customize the ribbon bar and drag down to select Developer. Press OK to complete the process.
Step 5: Now you can see the Developer tab next to the View tab. Click on the Developer tab and go to Macro Security
Step 6: Once you click on Macro Security, a trust will open center screen. Locate the Macrosettings where you need to enable all macros and check the box for Trust access to the VBA Project Object Model in Developer Macro Settings .
Once all of this is done. Click "OK" to continue with the next process.
Step 7: After the initial setup process,macros can be created in the project window by clicking Macro.
Step 8: A pop-up screen will appear where you can create the macro. TypeMacro Name as needed and click Create. The macro name here is HI in Presentation1.
Step 9: A Microsoft VB application window will open in which you should write a set of instructions that will be used when the macro is called from the presentation Executed sequentially. In this Module1 (Code) Screen, you can write the code to be executed. I just wrote aMsgBox("Good Day!!!"). This means MsgBox is a predefined function which will display what is written inside the brackets. In the previous line, the macro name is HI. So whatever you write in that macro HI, it will be executed sequentially when called.
Step 10: After writing the code in the macro, you should close the window and return to Presentation 1. Go toMacro and click on the name(HI) of the macro and press the Run command which will execute the code.
Step 11: When you click Run, you can see the message "Good day!!!" displayed in the message box of Presentation1. Step 12: Successfully create the macro and test it. It's time to add it to the screen so that all code can be executed with a single click. To do this, go to theFiletab and click on the Options
ScanQuick Access Toolbar . When you select Can see the custom Quick Access Toolbar, drag down and select Macros.
Step 13: All created macros will be listed. You need to choose what you want to add.Presentation1 HI is selected here because it is the one we created. Click to add. Now the macro HI has been added to the custom Quick Access Toolbar.
Step 14: You can modify the macro with icon and name as shown below.
Step 15: After clicking the Modify button, you can select the icon from the predefined collection and can change the name as shown in the image below.
Step 16: Select the icon and enter the name and click OK. Now you can see the added icon and name in the toolbar
Step 17: Go to the home page and you can see the custom icon on top of the presentation . When you want to call a macro, just click on the icon at the top. The macro will run automatically and display the results.
Macros are especially used in scenarios where repeated command sequences are required. It could be your custom design or using VBA to code a calculation such as addition in a pre-made way.
The above is the detailed content of How to Create a Macro in Powerpoint Step by Step. For more information, please follow other related articles on the PHP Chinese website!