Image of Navigational Map linked to Home / Contents / Search Christmas Present(ations)?

by Shane van de Vorstenbosch - FFE Building Services
Image of Line Break

As a child I learnt that Christmas came once a year, and with it came presents. Each year the presents become bigger and better.

As an adult I learnt that Software releases come almost as often, and with them come features. Each year the features become bigger and, well, bigger.

Earlier this year I eagerly installed PowerPoint 97. I barely noticed the minor changes to the interface as I honed in on the big parcel - "VBA"

Visual Basic for Applications was to be a milestone in the history of PowerPoint. Unfortunately miles have long since been made obsolete and we have "kilometre stones". Not as large a distance as planned, but still a distance.

I have dabbled in Computer Based Training and have also done programming in C++ and Visual Basic. My expectations for VBA were shaped by these activities and I was hoping to have the ease of Visual Basic with the power of a multimedia authoring package.

My expectations were not met. The following discussion reflects upon PowerPoint VBA's strengths and weaknesses from my expectations.


Application independent

For anyone who wants to be able to program across Microsoft's Office applications, VBA is useful. It provides one interface and a common feel. I would not say a common syntax, because objects within each application have their own structures. Word and Excel are similar, but PowerPoint is significantly different.

Design automation

The main focus for PowerPoint VBA appears to be for the automating of presentation designs. The help files are definitely aimed at the design stage with almost no examples of slide show code. This allows many of the shortcomings of the package to be over come.

For example, in Asymetrix's Compel it is possible to take bullets from one slide and turn each bullet into a new slide. The bullet's text becomes the heading, and is a link back to the original slide. The bullet becomes a link to the new slide. This is a great feature that I used extensively for quickly building a presentation. It is also a feature that Microsoft failed to copy.

To get around the problem VBA came to the rescue. The following code will take a text object and create a slide. Hyperlinks are created, and the user is returned to the original screen:

Sub CreateLinkedSlideFromPoint() ' Will take the current object and copy its name. ' It then creates a new slide and copies the object's name ' into the title and the name of the slide. ' The title is linked back to the first slide. ' The original object is then linked to the slide. Dim CurrentObject As String Dim NewSlide As String Dim OldSlide As String ' Save the object name and slide name. CurrentObject = ActiveWindow.Selection.ShapeRange.Name OldSlide = ActiveWindow.Selection.SlideRange.Name NewTitle = ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Text ' Create a new slide ActiveWindow.View.GotoSlide Index:=ActivePresentation.Slides.Add(Index:=(ActiveWindow.View.Slide.SlideIndex + 1), Layout:=ppLayoutText).SlideIndex ' Select the heading and copy the text into it ActiveWindow.Selection.SlideRange.Shapes(1).Select ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Text = NewTitle ' Change the name of the slide ActiveWindow.Selection.SlideRange.Name = NewTitle ' Create a hyperlink back to the original slide With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick).Hyperlink .Address = "" .SubAddress = OldSlide End With ' Return to the original slide and select the object ActiveWindow.View.GotoSlide (ActiveWindow.Selection.SlideRange.SlideIndex - 1) ActiveWindow.Selection.SlideRange.Shapes(CurrentObject).Select ' Set the hyperlink to the new slide With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick).Hyperlink .Address = "" .SubAddress = NewTitle End With End Sub

This routine could be modified to automatically go through the bullets of a list.

The possibilities for simplifying the creation of presentations are immense. PowerPoint does not have to be limited to the tools provided. This is the great potential of PowerPoint VBA.


Very little slide show help

The big weakness that quickly became apparent was the lack of help with slide show code. I want to be able to dazzle my audience through impressive presentations. This is more than just looks. Everyone can now put a reasonable presentation together using the numerous wizards. I want action! Third party books are also very light on with help. The initial wave of releases focused on the design issues and provided virtually no tips on how to make presentations shine.

Object obscurity

The next disappointment was the inconsistency between OCX properties and PowerPoint objects. I like the ease and openness of the property box. It means that I can quickly set up an object, and know how to change it dynamically. PowerPoint objects (eg text boxes, lines etc) retain the old dialogue boxes for setting up, and their structures rival the best bureaucracy.

I wanted to be able to change text dynamically throughout a presentation. The code to refer to the text property in one case was:

SlideShowWindows(i).View.Slide.Item("Rectangle 3").TextFrame.TextRange.Text

There are multiple methods of reaching the same end point.

To ease the addressing nightmare, I use the following subroutine:

Public Const ThisFile As String = "Introduction to fire standards" Public Sub SetGlobals() Dim AllOK As Boolean On Error GoTo SetGlobalsError AllOK = False For i = 1 To SlideShowWindows.Count If (SlideShowWindows(i).Presentation.Name = ThisFile) Then Set ThisSlideShowWindow = SlideShowWindows(i) Set ThisPresentation = ThisSlideShowWindow.Presentation Set ThisWindow = ThisSlideShowWindow.View.Slide ThisWindowIndex = ThisSlideShowWindow.View.CurrentShowPosition AllOK = True Else MsgBox SlideShowWindows(i).Presentation.Name End If Next i Exit Sub If AllOK = False Then MsgBox "Slide show not found. Check the SlideShowStuff file definition" End If SetGlobalsError: MsgBox "Error with SetGlobals" End Sub

This then allows me to refer to either ThisPresentation, ThisWindow, or ThisWindowIndex when accessing PowerPoint objects. The previous example becomes:

ThisWindow.Item("Rectangle 3").TextFrame.TextRange.Text

Programming experience required

There is a big jump between not using VBA and using VBA in terms of assumed knowledge. Any one can create a simple presentation that looks good and gets the message across. To write a VBA script, however, requires the user to be familiar with programming.

To complicate the matter, it is not just a relatively simple matter of learning Visual Basic. The complicated object structures are a hurdle for experienced programmers. The novice has to learn programming while wading through a complicated object structure.

Hidden object names

The above example makes reference to "Rectangle 3" which is the default name created by PowerPoint. The programmer needs to know this name when referencing an object. The only place where I have found the name is in the Custom Animation screen. There is no method to modify this name without writing VBA code. An unchangeable name or number also references slides.

The following code was attached to a button on the toolbar to provide easy access to a slide or object's name:

Sub ChangeName()
On Error GoTo ChangeNameError  

' Is an object selected? 
If ActiveWindow.Selection.Type <> 0 Then
    ' Change the object's name  
    ActiveWindow.Selection.ShapeRange.Name = InputBox("Please enter object name", "Rename Object", ActiveWindow.Selection.ShapeRange.Name)
    'Change the slide's name
    ActiveWindow.Selection.SlideRange.Name = InputBox("Please enter slide name", "Rename Object", ActiveWindow.Selection.SlideRange.Name)
End If
Exit Sub

   ' This removes the problem if they press cancel. 
End Sub

This routine is invaluable for being able to make code readable, as well as simplifying the linking to other slides. For example, slide changes to "TitleScreen" are much easier to understand than slide changes to screen 3.

Lack of hooks

PowerPoint provides two main points for initiating a function within a slide show - when clicking on an object, or when moving the cursor above an object.

What would have been a better solution would be to have provided hooks for:

No custom animation capabilities

PowerPoint has more standard animations (and some are quite impressive), but they are only triggered upon slide entry, or a mouse click.

It is not possible, for example, to move a PowerPoint object across the screen. It is possible to move its location, but the entire screen is redrawn. This is not even close to animation!


PowerPoint VBA provides a great opportunity to extend PowerPoint's design features. It fails, however, to offer an easy to configure and powerful extension to a slide show.

PowerPoint does not compete against multimedia authoring tools, and is not a good solution for computer based training. Its provides a very poor scripting environment for slide shows, and fails to provide simple functions such as animation.

Its inclusion in Microsoft Office makes it a good choice for presentations. For multimedia applications, the money saved in the purchase is lost in the implementation. For any serious development it is best left in the box and some other multimedia authoring package be used.

Written by: Shane van de Vorstenbosch
July '97

Image of Arrow linked to Previous Article Image of Arrow linked to Next Article
Image of Line Break