Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Feb 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    New toolbar or menu Powerpoint 2002 (Powerpoint 2002)

    I need to create a new menu and toolbar within Powerpoint, and be able to distribute this to all users. Where are customised toolbars stored? Do I need to create an add-in for this?

    I haven't done any VBA coding in Powerpoint before, so plesae reply in idiot's guide format! Thanks for any help.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: New toolbar or menu Powerpoint 2002 (Powerpoint 2002)

    Yes, you'll have to create an add-in.

    Steve Rindsberg site The PowerPoint FAQ List has a good section Creating and Installing Add-ins, Toolbars, Buttons.

    If you want to read up on VBA in Poweroint, also see the section above it, For VBeginners.

  3. #3
    Lounger
    Join Date
    Feb 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: New toolbar or menu Powerpoint 2002 (Powerpoint 2002)

    Brilliant Hans, thanks for this, got my toolbar loading now with no problems.

    However, I've tried to create a new menu item to add to the standard menu in Powerpoint, so it appears before the "Help" menu, but I ccan't get this work.

    So far I have the following code:

    Dim Menubar As CommandBar
    Dim Button As CommandBarButton
    Dim MyMenubar
    ' Give the toolbar a name
    MyMenubar = "TEST"

    On Error Resume Next
    ' so that it doesn't stop on the next line if the toolbar's already there

    ' Create the menu; PowerPoint will error if it already exists

    Set Menubar = CommandBars.Add(MyMenubar, msoBarRight, menubar:=True)


    ' Set Menu = CommandBars.Add(Name:=MyToolbar, Position:=msoBarPopup, Temporary:=True)
    If Err.Number <> 0 Then
    ' The toolbar's already there, so we have nothing to do
    Exit Sub
    End If

    On Error GoTo ErrorHandler

    I save this as an addin, etc, but the TEST menu is not appearing.

    I would like a "TEST" menu to appear before the "HELP" menu, on the standard installed menu bar within Powerpoint.

    Can you help?

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: New toolbar or menu Powerpoint 2002 (Powerpoint 2002)

    A menu is not a commandbar, but a control of type msoControlPopup on the existing commandbar named Menu Bar. So you can use code like this:

    Dim MenuBar As CommandBar
    Dim MyMenu As CommandBarPopup
    Dim MyItem As CommandBarButton

    Set MenuBar = CommandBars("Menu Bar")

    On Error Resume Next

    ' The Help menu has ID 30010
    Set MyMenu = MenuBar.Controls.Add( _
    Type:=msoControlPopup, _
    Before:=MenuBar.FindControl(Id:=30010).Index, _
    Temporary:=True)

    If Err.Number <> 0 Then
    ' The toolbar's already there, so we have nothing to do
    Exit Sub
    End If

    With MyMenu
    .Caption = "Test Menu"
    .Visible = True
    End With

    Set MyItem = MyMenu.Controls.Add( _
    Type:=msoControlButton, _
    Temporary:=True)

    With MyItem
    .Caption = "Test Item"
    .Visible = True
    .Style = msoButtonCaption
    .OnAction = "MyMacro"
    End With

    On Error GoTo ErrorHandler

  5. #5
    Lounger
    Join Date
    Feb 2004
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: New toolbar or menu Powerpoint 2002 (Powerpoint 2002)

    Thanks, worked like a treat.

    Thanks for the quick response, as ever.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •