Supercharge your PowerPoint productivity with

Supercharge your PPT Productivity with PPTools - Click here to learn more.

Tell me about PPTools

PowerPoint 2007 VBA bugs/problems


PPTools
Shape Styles brings the power of styles to PowerPoint. Apply complex formatting with a single click
Merge Excel, CSV or tab-delimited data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more
FixLinks prevents broken links when you distribute PowerPoint presentations
Optimizer saves disk space and bandwidth, shrinks your PowerPoint presentations to the right size for email, screenshow or printing
PPT2HTML gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements
Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF
Image Export converts PowerPoint slides to JPG, PNG, GIF, WMF and more

There's an awful lot of unfinished business that we hope will be addressed in a service pack, but for now, PowerPoint 2007 and VBA just aren't very well assembled.

The Object Browser shows you quite a bit of mouth-watering stuff, but way too much of it seems to be methods and properties of objects that you're given no way of accessing. And there are bugs.

Trashed Images, Red-X is back

When you use Slides.InsertFromFile to insert a slide from one PowerPoint 2007 file into another, the images will not appear. Instead you get a red-x and a message that says "The image cannot be displayed. Your computer may not have enough memory ..." etc.

Slides inserted from PowerPoint 2003 presentations and PowerPoint 2007 presentations that have been back-saved to 97-2003 format don't suffer this problem.

Slow inserts from file

Inserting slides programmatically via Slides.InsertFromFile can be very slow when inserting from PowerPoint 2003 and earlier files, probably because PowerPoint 2007 has to convert them to the new format on the fly.

Slide Export method produces bad image files after applying SP1

By default, PPT exports at 960x720* when you choose File, Save As, JPG. This seems to be the limit for its Slide.Export now; if you use Slide.Export at a higher resolution, you get a 960x720 image padded at right and bottom with black to fill out the requested image size.

Sub TestExports()
    Dim oSld As Slide
    For Each oSld In ActivePresentation.Slides
        Call oSld.Export("C:\Documents and Settings\steve\My Documents\ImageExportTests\" & _
            "Slide_" & CStr(oSld.SlideIndex) & ".JPG", _
            "JPG", 2048, 1536)
    Next
    MsgBox "Done"
End Sub

* Strictly speaking, the default (and limit) is not 960 pixels. It's the width of the slide in inches times the current Windows display dpi. Normally PPT slides are 10" wide and Windows is set to 96dpi. If you change either, the image export default/limit changes accordingly.

Inconsistent cursor positioning when inserting symbols

Tested in 2007 SP1 and 2003 SP2:

Positioning of insertion point and character selection after using the InsertSymbol method of text.

Both 2003 show inconsistencies depending on whether the insertion point is at the beginning of the text in a text shape or at some other point.

2003 and 2007 behave differently from one another, therefore 2007 breaks existing code.

Insert a textbox and populate it with the letters "abcdef"

Do three tests, using the code below. Note where the insertion point or selection is in each case:

1. Place the cursor before the 'a' and run the test code.

2003: First TWO characters are selected (ie, inserted character and the original A); no insertion point
2007: Insertion point is left BEFORE the inserted character, no characters are left selected

2. Put the cursor between the 'c' and 'd' and run the test code.

2003: Inserted character is selected; no insertion point
2007: Insertion point is AFTER the inserted character, no characters left selected

3. Put the cursor after the 'f' and run the test code.

2003: Inserted character is selected; no inserted point
2007: Insertion point is AFTER the inserted character; no characters left selected

Code:

 
Sub test()
Dim tr As TextRange

If Not (ActiveWindow.Selection.Type = ppSelectionNone) Then
   Set tr = ActiveWindow.Selection.TextRange.InsertSymbol("Wingdings 3", 170, True)
Else
    MsgBox "No point for insertion has been defined", vbOKOnly, "No Insertion  Point"
End If

End Sub

Accessing some properties of Hyperlinks can crash PowerPoint 2007

FIXED IN SP1

Add a text box to a one-slide blank presentation, type some text into it and assign it a hyperlink to a web page.
Add the following code to a module in your presentation. Don't run the code until after you've saved the presentation as a PPTM (macro enabled) file or you'll lose your work:

Sub WatchMeDie()
  MsgBox "I'll display one more message box then crash"
  MsgBox ActivePresentation.Slides(1).Hyperlinks(1).Parent.Parent.Text
End Sub

PowerPoint displays the text in your text box then crashes.
The same code works fine in PowerPoint 97 through 2003.

Missing add-ins provoke error message

If an add-in is registered and set to auto-load but the Path value in the registry points to a file that doesn't exist, PPT displays a message box to complain about it whenever it starts up. Previous versions do not do this. They simply start up without loading the missing add-in.

This means that users/developers can no longer just rename or delete a PPA/PPAM file to temporarily or permanently uninstall/disable an add-in. At least not without producing needless "noise" at every PPT startup.

Inserting pictures from a URL no longer works

In previous PPT versions you could insert a picture from file under program control and specify a URL as the path to the file.
When you do this in PPT 2007, you get a "File not found" error when the code runs. The same code will work in earlier versions, and you can still manually insert the same file from the URL using Insert, Picture, From File.

Redraw problems

In at least some instances, if you make programmatic changes to the slide master, the slide thumbnails in normal view update to reflect the change but the current slide does not. Probably will need to use GoToSlide to force a redraw of current slide.

Charts

If you need to automate charts in PowerPoint 2007, it'd be best if you change your name and move to another town where nobody knows that you do PowerPoint programming.

The chart objects you get in PowerPoint 2007 when you add a new chart expose no methods or properties to VBA. In short, you can't do anything with them.

When you install Office 2007, you have the option of including MSGraph, the application PowerPoint used for charts in previous versions. You'll want this if you need to work with charts from previous PowerPoint versions and/or to create new charts via automation.

Tags (RTM)

Tags applied to some shapes (OLE shapes, diagrams, possibly others) in PowerPoint 2003 and earlier are lost when you open the PPT file in PowerPoint 2007.

Fonts collection (RTM/b)

The Presentation.Fonts collection returns some correct information but in other cases it returns empty strings (instead of a font name, for example) or errors when
querying some properties (.Embeddable).

Example:

Create a new default blank presentation. The title/subtitle slide text placeholders will be Calibri. Add text to both, leave the title as is and change the subtitle to
some other font. Then run the following code:

Sub DemoFarkledFontsCollection()

    Dim oFont As Font
    Dim oFont2 As Font2

    With ActivePresentation
        ' returns the correct .Count
        Debug.Print .Fonts.Count
        For Each oFont In .Fonts
            With oFont
                ' returns nothing if the font is Calibri, possibly other "special" (?) fonts
                ' returns the correct font name otherwise, it seems
                Debug.Print "Font Name: " & .Name
                ' errors here
                Debug.Print .Embeddable
                Debug.Print .Embedded
            End With
        Next
    End With

    ' perhaps the Font2 object might return better results but it doesn't appear
    ' that it's exposed through PPT.  No help there?

End Sub

VBA Help (RTM/b)

The amount of help available in VBA increased in around June of 2007, but the quality of the added help is marginal at best. It barely addresses the new objects in 2007 and when it does, the information and code is liable to be incomplete of simply wrong.

If you're forced to work off-line or your organization's firewall doesn't permit you to use MS' online help, you're pretty much out of luck. Offline help is thin and largely useless.

Misc annoyances

You can't get a valid .Nodes.Count value or iterate the nodes collection of a line.

The SmartArt model is read-only. You can read from it by treating it as a kind of group shape but can't write TO it.


Page copy protected against web site content infringement by Copyscape Contents © 1995 - 2008 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese



Supercharge your PPT Productivity with PPTools


content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

PowerPoint 2007 VBA bugs/problems
http://www.pptfaq.com/FAQ00889.htm
Last update 05 September, 2008