views:

40

answers:

2

I want to create an addin for PowerPoint that adds a button to the PowerPoint toolbar. How can I do this?

+1  A: 

Create a new module and add the below autoopen function. You would need to save the file as ppa in the addins folder.

Sub Auto_open()

    Dim oToolbar As CommandBar
    Dim oButton As CommandBarButton

    'Create the toolbar
    Set oToolbar = CommandBars.Add(name:="CommandbarName", Position:=msoBarTop)

    'Add the first button
    Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)

    With oButton
        .Caption = "New button"
        .OnAction = "FunctionTocall"
        .Style = msoButtonIconAndWrapCaption
        .FaceId = 11 'icon
    End With

End Sub
A: 

IF your target is PowerPoint 2007, check Robert Green,Create an Application-Level Add-In to Automate Common Office Tasks

http://msdn.microsoft.com/en-us/library/dd935909.aspx

mas_oz2k1