Record a macro
- On the Tools menu, point to Macro, and then click Record New Macro.
- In the Macro name box, enter a name for the macro (macro: An action or a set of actions you can use to automate tasks. Macros are recorded in the Visual Basic for Applications programming language.).
Note The first character of the macro name must be a letter. Other characters can be letters, numbers, or underscore characters. Spaces are not allowed in a macro name; an underscore character works well as a word separator.
- In the Store macro in box, click the location where you want to store the macro.
-
If you want to include a description of the macro, type it in the Description box.
- Click OK.
- Record the actions you want for the macro, and then on the Stop Recording
toolbar (toolbar: A bar with buttons and options that you use to carry out commands. To display a toolbar, click Customize on the Tools menu, and then click the Toolbars tab.), click Stop Recording
.
Create a macro using Microsoft Visual Basic
- In Microsoft PowerPoint, on the Tools menu, point to Macro, and then click Visual Basic Editor.
- In Microsoft Visual Basic Editor (Microsoft Visual Basic Editor: An environment in which you can edit macros that you've recorded and write new macros and Visual Basic for Applications programs.), on the Insert menu, click Module.
- Type or copy your code into the code window of the module (module: A collection of declarations, statements, and procedures stored together as one named unit. There are two types of modules: standard modules and class modules.).
- If you want to run the macro (macro: An action or a set of actions you can use to automate tasks. Macros are recorded in the Visual Basic for Applications programming language.) from the module window, press F5.
- When you're finished writing your macro, on the File menu, click Close and Return to Microsoft PowerPoint.
Copy part of a macro to create another macro
- Open the presentation that contains the macro (macro: An action or a set of actions you can use to automate tasks. Macros are recorded in the Visual Basic for Applications programming language.) you want to copy.
- On the Tools menu, point to Macro, and then click Macros.
- In the Macro name box, enter the name of the macro that you want to copy.
- Click Edit.
- Select the lines of the macro you want to copy. To copy the entire macro, make sure to include the Sub and End Sub lines in the selection.
- Click Copy
, switch to the module (module: A collection of declarations, statements, and procedures stored together as one named unit. There are two types of modules: standard modules and class modules.) where you want to place the code, and then click Paste
.