There’s an awful lot of unfinished business that we hope will be addressed in service packs, but for now, PowerPoint 2007 and VBA 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. Oh my, are there bugs.
Adding/Formatting text in slide show view
Code that creates shapes runs somewhat slowly in slide show view, but if the code also adds text to the shapes and/or formats the text in shapes, code execution slows to a crawl. If at all possible, do the operation in normal or some other view, where the same code will run reasonably fast.
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 in code.
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.
Tables
In previous versions, you could access a table cell’s .Shape property to return a shape whose properties you could set like any other shape. Some of these properties no longer work, though they’re still listed in Intellisense and the Object Browser.
Can’t customize context menus
Previous add-in features that rely on context (right-click/pop-up) menu customization won’t work in 2007.
Here’s more information about why this will not be fixed. Net: if your add-in uses context menus, you’ll simply have to rewrite them to use the ribbon instead.
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. Updating the files you’re inserting slides from to PPT 2007 format speeds things up considerably, but because of the Red-X problem with images mentioned above, may not be practical.
Slide Export method produces bad image files after applying SP1
By default, PPT exports at 960×720* 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 960×720 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
When using the InsertSymbol method to add characters to text, PowerPoint 2003 and 2007 (through SP1) behave inconsistently, 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.
To reproduce the problem:
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.
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.
Tags
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
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
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.