PowerPoint

Make code run as slide show starts

Ease of Use

Intermediate

Version tested with

2002-2007 

Submitted by:

John Wilson

Description:

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. 

Discussion:

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

Code:

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 203 times.

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