views:

197

answers:

1

I am trying to write an Add-In to PowerPoint that does basically one thing: Give users a button somewhere to click, once they click on it the currently selected TextField should get syntax highlighted.

The Syntax highlighting part is easy, I'm just having a real hard time finding some good information on how to successfully interact with PowerPoint from code. There are some MSDN articles highlighting how to add controls on document start or AddSlide, but no good information on how to extend the UI.

Has anyone had some experience in this field and could point me to some resource that may help?

Also, I am running PowerPoint 2007 while my customer may end up running PPT2003. How is the backwards compatibility of the Add-ins?

Update: I already use VSTO, the main problem is to find out on how to actually add buttons to PowerPoint. I already managed to add a shape or manipulate one.

+1  A: 

Here's some help with the core ask - find the active shape and do something with its text. This VBA example that can be ported easily to VB.NET/C#.

Sub FindActiveShapeFormatting()
Dim Sel As Selection
Set Sel = ActiveWindow.Selection
With Sel
    If .Type = ppSelectionShapes Then
        Dim sr As ShapeRange
        Set sr = .ShapeRange
        */ With .TextRange you can now manipulate the text inside the shape
        sr.TextFrame.TextRange.Words(1).Font.Bold = msoCTrue
    End If
End With
End Sub

For interacting with Office from .NET, the best/easiest way is to use VSTO (Visual Studio Tools for Office). Check this out for more details: Beginning VSTO development

Otaku
Thanks a lot. I already used VSTO, it's just pretty hard to come by documentation on how to use VSTO to add stuff to PPT..
Tigraine
Fair enough - VSTO documentation for PowerPoint lags behind Excel/Word, primarily because there are not nearly as many VSTO controls for PowerPoint and it's sort of the "odd man out of Office programming". Are there specific steps I can help you with besides the code above?
Otaku