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.

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.

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.

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.

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.

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:

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.

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.

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.