Make code run as slide show starts

Ease of Use


Version tested with


Submitted by:

John Wilson


A common problem in PowerPoint is getting code to run automatically as a slide show starts. Unlike other apps auto_open only works in AddIns. 


Any situation where you want code to run at the start of a show. 


instructions for use


Sub OnSlideShowPageChange() Dim i As Integer i = ActivePresentation.SlideShowWindow.View.CurrentShowPosition If i <> 1 Then Exit Sub MsgBox "Your code goes here" End Sub

How to use:

  1. Open the VBE by pressing Alt f11
  2. Insert > a module
  3. Copy the code and Paste into the module
  4. Close the VBE

Test the code:

  1. Test the code by running the slide show.
  2. The message box will appear when slide 1 plays.
  3. Any code that you would like to run with the start of the show can be inserted instead of the msgbox.
  4. Note the code will run again if you return to slide 1. You could modify to make code run on a specific slide.

Sample File:

sample.zip 27.04KB 

Approved by mdmackillop

This entry has been viewed 185 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2014 VBA Express