PowerPoint tips, hints and tutorials that will change your presentations for ever!



Custom Shows
vba code
Games for teachers
Flash Cards
Multiple Instances
PowerPoint 2007
Mail Merge
Random events
Set spellcheck language

Home buttonTutorial buttonContact buttonProducts button

Auto Update Text During Slide Show

A common question is "How can I auto update text on a slide when the slide canges or when a presentation loops.

Instructions are for 2007 onwards but you should be able to adapt for 2003.

To do this properly with code requires you to write a Class and use events to trigger the code. For most people this is a step too far.  This page is a simpler way to get there.

Legacy Code

There were legacy pseudo events that date back to version 97 that could detect page changes in a slide show. Unfortunately they are not reliable. Typical behaviour is that they work just fine in testing but save and reopen (or give to a client!) and they fail. Not good.

How Can We Make It More Reliable

The secret seems to be that the code will run IF the vb editor has been accessed during the current session. This doesn't really help unless there is a simple way to achieve this. Fortunately there is! Just add any ActivX object from the control tool box and the vb editor is invisibly accessed when the file opens.

Let's Try!

create say a three slide presentation. Go to the Master View and choose a Custom Layout you don't intend to use. Add an Activx object. Any will do. If you are using 2003 then you don't have custom layouts - place it OFF SLIDE on the title master.

On the first slide add a textbox add the text "DATE". Rename it to "myText" and then copy / paste to all slides.

The Code

Here's the code for the pseudo event. It will add the date and time, updating every slide change.

Sub OnSlideShowPageChange(SWin As SlideShowWindow)
Dim opres As Presentation
Set opres = SWin.Parent
Dim lngNum As Long
lngNum = SWin.View.CurrentShowPosition
opres.Slides(lngNum).Shapes("myText").TextFrame.TextRange = "Date & Time: " & Format(Now, "dd mmmm yyyy hh:mm")
End Sub






Back to the Index Page



Articles on your favourite sport

Free Microsoft PowerPoint Advice, help and tutorials, Template Links
This website is sponsored by Technology Trish Ltd
© Technology Trish 2007
Registered in England and Wales No.5780175
PowerPoint® is a registered trademark of the Microsoft Corporation