Macros are added code that can repeat or automate tasks within another program. Think of them as a translation of what you want PowerPoint to do into a language the computer can understand. The code used to create macros for PowerPoint is written in Visual Basic for Applications, or VBA. The VBA commands available for PowerPoint are referred to as the PowerPoint object model.
Macros are very useful little toys. They can run while designing and editing a presentation or they can run while the presentation is being displayed.
Macros that run while in edit mode reduce the tedium in creating the presentation by making it easier to do certain tasks such as the changes Larry needs to make to modify his presentations for the potential clients . Rather than editing each slide by hand, he is going to build a series of macros allowing PowerPoint to ask him what to change and then make the changes for him.
Macros that run during a presentation allow slide elements to turn on and off, change slide elements, get text or other input from the participants , or record data about the presentations.
More extensive macros perform complex tasks easily. Some of the most requested macros can be found in the PPT FAQ, as well as on the sites run by PowerPoint MVPs Shyam Pillai and Chirag Dalal. URLs for these sites can be found in Appendix A, Where to Find More Help.
While there is not a single book on VBA for PowerPoint, you can find some information in the PowerPoint help sections on macro creation and the VBA language. There are also several good VBA resources on-line which are also listed in Appendix A. You can learn a lot about VBA and macros by recording and customizing your own macros.
My best suggestion for learning to use macros is to read and join the PowerPoint newsgroup (see Appendix A for information on accessing it). Questions are posted daily on how to make various macros work. If you are having a coding problem, feel free to post it to the group . Tell us what PowerPoint version you are using, what you are trying to do, what is happening, and what the code is you have already written. The more details you give, the more likely you are to get quick help.
PowerPoint macros can be created by either recording functionality or by using the Visual Basic Editor. In most cases, you will start by recording the basic process you wish to automate and then adjust the resulting code to do exactly what you want, when you want.
Why adjust the code? Because when you record a macro, you record an exact set of steps. PowerPoint doesn't know you really meant to record a process. You generally will need to edit your macros to tailor them to your specific situations.
As your VB skills expand, you will be able to create macros from scratch in the VB editor. This skill set is beyond the scope of this book. We will touch on it at the end of this chapter so you have resources to use for more advanced macro work.
Every time you get ready to run or record a macro which is in development, save the presentation file. It is also a good idea to use new file names for these temporary copies.
The basic process Larry went through to create his macro has seven steps:
Plan what the macro needs to do
Record, edit and test each basic macro
Create a toolbar with buttons to run each macro individually
To make it easier to run the series of macros, create a routine that will call each macro in turn
Add a toolbar button to run the full process macro
Change the macro to an add-in
Distribute the add-in