Running a VBA Macro When a PowerPoint Opens
If you need to start a Macro automatically when a PowerPoint .ppt or .pptx file opens, then here are some tips that can be helpful to accomplish the need.
There is a free addin AutoEvents that enables PowerPoint to run macros automatically on certain events. You can download the addin from http://skp.mvps.org/autoevents.htm and it will be helpful to run macros on the following events:
- Sub Auto_Open() – Gets executed immediately after the presentation is opened.
- Sub Auto_Close() – Gets executed prior to the presentation is closed.
- Sub Auto_Print() – Gets executed prior to the presentation being printed.
- Sub Auto_ShowBegin() – Gets executed when the show begins.
- Sub Auto_ShowEnd() – Gets executed when the show ends.
- Sub Auto_NextSlide(Index as Long) – Gets executed before the slideshow moves onto the next slide. Index represents the SlideIndex of the Slide about to be displayed.
So, if you need to run a Macro when the PowerPoint is opened, you may implement Auto_Open() using VBA.
Even if PowerPoint 2000 introduced application level events, PowerPoint does not include any automatic macro support which are available in Excel & Word. The only ones available are Auto_Open & Auto_Close macros. However these fire automatically provided they are within an add-in.
Alternatively you can also check Event Generator 2.0 if you are looking to port your event-based presentations to PowerPoint 2007 and 2010. Learn more in http://officeone.mvps.org/eventgen/eventgen.html
Learn more about PowerPoint Application Level Events for MS PowerPoint 2010 here: http://code.msdn.microsoft.com/office/PowerPoint-2010-Add-Series-fccd83cc