Creating New Macros in Microsoft PowerPoint 2007

Written by:  • Edited by: Rebecca Scudder
Updated Nov 22, 2009
• Related Guides: Microsoft | Powerpoint 2007 | Macro

One of the things I really miss from previous versions of Microsoft PowerPoint is the ability to simply record a macro. You can still create macros in PowerPoint 2007, but it requires a little more work.

Macros in Microsoft PowerPoint 2007

In previous versions of Microsoft PowerPoint, creating basic macros was easy. There was a macro recording feature that allowed users to click a button to start recording, manually perform the tasks to include in the macro, and then click another button to stop recording. This functionality is not part of the PowerPoint 2007 software. However, there are some third-party applications such as Macro Express 3 which allow you to create recorded macros for any Windows application.

The ability to create macros still exists in PowerPoint 2007, but now they have to be written in Visual Basic for Applications (VBA). Before you shudder and decide to look for another alternative, this isn’t as bad as it sounds. Although you will need to gain some familiarity with VBA to create macros in this manner, you don’t have to be a whiz at programming to get this done.

Later in this series, we will give some sample VBA code commonly used in PowerPoint macro creation that you can just cut and paste into the Visual Basic Editor and use to create macros for your own presentations. For now, we’ll cover the general steps needed to create a macro in PowerPoint 2007.

How to Create a Macro

Before we begin, make sure that the Developer tab is visible on your PowerPoint ribbon and that macros have been enabled. If this is not done, refer to Part 1 of this series, and follow the instructions there before continuing.

In order for our macros to work after we define them, we’ll first need to save our PowerPoint presentation in a special way. To do this, click on the Office button and choose Other Formats from the Save As category. Alternatively, you could press the shortcut key, F12, on your keyboard to access this option.

Save as
click to enlarge

When the Save As dialog box opens, select PowerPoint Macro-Enabled Presentation from the drop-down list next to Save as Type. Click Save to continue.

Save as Macro Enabled Presentation
click to enlarge

Now, we’re finally ready to create a macro. Open the Developer tab and click on the View Macros button as shown in the screenshot below.

View Macros
click to enlarge

This will open the Macro dialog box, which should look familiar to those who used the macro recording function available in previous versions of PowerPoint. The only thing mandatory to do in this box is name your new macro. However, it’s also a good idea to provide a short description of what the macro will do, especially if your memory is as bad as mine. For now, we’ll just give this macro the incredibly descriptive name of TestMacro.

Macro Dialog Box
click to enlarge

After you’ve finished here, click Create to continue. The Visual Basic Editor window will now appear on your screen, with the cursor placed between the lines of code that read as Sub TestMacro( ) and End Sub. Any commands that we want the macro to perform should be typed or copied in between these two lines.

Open Visual Basic Editor
click to enlarge

We’ll save more detailed examples of VBA code for later articles in this series, but we’ll go ahead and create a very simple macro here just to illustrate the process. Let’s suppose that we want to write a macro that will save our PowerPoint presentation as an HTML file entitled testfile.html. The VBA code needed for this command is:

ActivePresentation.SaveAs "c:\testfile.html", ppSaveAsHTMLv3, msoTrue

In the Visual Basic Editor, our macro code will now look like this:

Modified Code
click to enlarge

At this point, we could include additional code if we wanted the macro to perform more tasks, but we'll leave it just like this for now. We can go ahead and save the macro file by either pressing Ctrl+ S or choosing the Save option from the File menu on the Visual Basic Editor toolbar.

Save macro
click to enlarge

After saving, we can exit the editor by pressing Alt + Q or selecting Close and Return to Microsoft PowerPoint from the File menu.

Return to PowerPoint
click to enlarge

Now that the macro has been created, it can be used at any time. Next, in Part 3 of this series, we’ll cover how to run existing macros in PowerPoint 2007.


Comments

Showing all 11 comments
 
Sunney Feb 15, 2011 1:11 PM
PowerPoint Macro
Hi, basically i want to present a drop down list once a button is selected. Now in order to do this i need to record a macro then whist recording insert the drop down list already created into the slide. But im having touble recording a macro, and playing it, also saving it. I also dont know what code to write please help, Thanks.

Thanks guys
Sunney
JJ Dec 25, 2010 4:01 AM
Alt+T+M+R
Alt+T+M+R is the hot ticket. It records your macro.
Rene Dec 21, 2010 4:28 AM
This functionality is not part of the PowerPoint 2007 software..
Just use Alt-T-M-R to record your macro...
chanthim Nov 10, 2010 9:32 PM
create macro power point 2007
Hi how a u. I'm chanthim Now i have one problem (Create marcro in power point 2007) that i can not do it. so pls tell me a solving. I want to use the key (Ctrl + F4) to chang font or record macro in power point 2007. i hope u solving for me
january pakistan Nov 3, 2010 3:48 AM
RE: Creating New Macros in Microsoft PowerPoint 2007
oooooooohh,,i love the item u wrote,,,its amazing,,,
Richard Matt Oct 27, 2010 9:08 AM
Developer Tab
Great article! My appreciation for writing it.
For those of us who used google and jumped into the middle of your series, I do wish you had added a link to the part 1 presentation, instead of crypitcally saying we had to go there but not helping us get there.
Jana Jul 21, 2010 8:23 AM
shortcut
wow, this is amazing, thanks for the shortcut tip! solves all my problems:) it really works!
Suzanne Jul 21, 2010 6:55 AM
Adapting the macro to other languages
This is really useful! THANKS! Question, how do you set the macro with a different language i.e. Dutch or Spanish?
QpQ Jan 19, 2010 2:09 PM
rob, double thumbs up
Thanks rob. I was about to cry.
rob Sep 7, 2009 10:23 PM
shortcut solution
you can still use the old 2003 short cut
Alt T M R
to start and stop recording in the old way

bizarre really ...maybe they actually dropped off the button by accident ?
Randy Yri Aug 27, 2009 5:42 PM
Graded Quizzes
I would like to write a macro to automatically grade a ten question, multiple choice quiz that I have prepared. Is there an existing template or instructions available?
 
blog comments powered by Disqus
Email to a friend