I m not sure if this is the answer you want to hear, but development in PowerPoint with VBA is actually good. I do quite a bit of it (as well as Word and Excel) and it is robust enough. The PowerPoint OM that can be programmed against with VBA is updated with each of the new versions of PPT. In PPT 2007, you can create Custom XML against any object on a slide - far more powerful than options available in Excel and Word. In contrast, Word 2007 has Content Controls, which, in order for PPT to be some kind Crystal Reports light-weight replacement, it would benefit from. In PPT 2010 (beta), you can programmatically create SmartArt, for example, as you can with Word/Excel 2010. You can also programmatically work with media elements better than before. VSTO, from an OM perspective, doesn t offer a whole lot more than VBA though.
It may just depend on your needs though - do you create standard bullet slides? Do you do extended animation? Do you do reporting? Are you creating eLearning "apps"? If you have specific questions on the OM, we can try to help you here (but maybe the feature just doesn t exist).
Agreed that removing the macro recorder kind of sucked, that was a useful feature. Directly working with the PML/DML is also a pain. There are things that I wish the OM did support as well. But in concurrence with caving, I don t believe VBA is going away any time soon.
NOTE: THIS DOES NOT WORK. IT IS PROVIDED ONLY AS A STARTING POINT IF FOLKS WANT TO TRY TO DEVELOP THIS INTO SOMETHING THAT MAY WORK (if you can get it to work, please feel free to edit this post).
- Create a class called "clsPPTEvents"
Paste in the following code.
Public WithEvents PPTEvent As Application
Private Declare Function GetCursorPos Lib "user32" (ByVal lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Dim ret As Long
Dim mousePosition As POINTAPI
Private Sub PPTEvent_WindowSelectionChange(ByVal Sel As Selection)
Dim ElementID As Long
Dim Arg1 As Long
Dim Arg2 As Long
With Sel
If .Type = ppSelectionShapes Then
Dim sr As ShapeRange
sr = .ShapeRange
If sr.Type = msoChart Then
Dim sh As Shape
Dim slideNumber As Integer
slideNumber = ActiveWindow.View.Slide.SlideIndex
sh = ActivePresentation.Slides(slideNumber).Shapes(sr.Name)
Dim crt As Chart
crt = sh.Chart
H = ActiveWindow.Height
w = ActiveWindow.Width
ret = GetCursorPos(mousePosition)
x = mousePosition.x
y = mousePosition.y
crt.GetChartElement(x, y, ElementID, Arg1, Arg2)
MsgBox("X: " & x & ", Y: " & y & vbNewLine & _
"ElementID: " & ElementID & ", Arg1: " & Arg1 & ", Arg2: " & Arg2)
End If
End If
End With
End Sub
In a regular module, you can start/stop the event handling with this:
Public newPPTEvents As New clsPPTEvents
Sub StartEvents()
Set newPPTEvents.PPTEvent = Application
End Sub
Sub EndEvents()
Set newPPTEvents.PPTEvent = Nothing
End Sub
Note that in the code in #2, it doesn t work because of what GetCursorPos returns, which is the screen X, Y. In looking at event, it appears that what the GetChartElement wants is either the Window or Pane bounding box s coordinates or just the chart s itself.