PDA

View Full Version : Solved: Creating drop-down menu with add-ins



enfantter
08-18-2009, 01:19 AM
I'm aware how to programme a piece of vba code into an add in that is appearant in the toolbar everytime i open powerpoint.
But i would like to create a drop down menu (like fx Tools) which would have 2-3 entries created from add-ins.

Any of you aware of a method to create this

Please let me know if the description doesn't make sense...

John Wilson
08-18-2009, 03:07 AM
Something like this?

Sub Auto_Open()
Dim myMainMenuBar As CommandBar
Dim myCustomMenu As CommandBarControl
Dim myTempMenu As CommandBarControl
On Error Resume Next
'remove old menus
Application.CommandBars.ActiveMenuBar.Controls("MenuName").Delete
'add menu
Set myMainMenuBar = Application.CommandBars.ActiveMenuBar

Set myCustomMenu = myMainMenuBar.Controls.Add(Type:=msoControlPopup, _
before:=3) 'before menu 3
myCustomMenu.Caption = "MenuName"

'add menu item
Set myTempMenu = myCustomMenu.Controls.Add(Type:=msoControlButton)
With myTempMenu
.Caption = "Whatever"
.OnAction = "macro1name" 'name of macro
End With

'add another (repeat as needed)
Set myTempMenu = myCustomMenu.Controls.Add(Type:=msoControlButton)
With myTempMenu
.Caption = "Whatever2"
.OnAction = "macro2name" 'name of macro
End With
End Sub

enfantter
08-26-2009, 11:09 PM
This is exactly what i needed thank you !
I need one thing further though (sorry). I appologize if this is already answered somewhere else, but i cannot seem to make any of the available solutions work.

I would like to extend this so that it would converted into an add-in, so different users will be able to add this object to their tool-bar ...

John Wilson
08-26-2009, 11:36 PM
I'm assuming you saved as a .ppa file. All you need to do is send the .ppa to someone else and have them add it via Tools > Add Ins.

enfantter
08-26-2009, 11:56 PM
I tried that but it seems that there are some part of my code that conclicts ..
I dont know how pro you (assuming a lot) but ill try to post my presentation

John Wilson
08-27-2009, 12:06 AM
You can post me the ppa file if you wish.
john ATSIGN pptalchemy.co.uk

Be aware that any coding solution may not be free as I am a full time professional. No charge for a quick look though.

enfantter
08-27-2009, 12:10 AM
Ok thank you - but the problem is that outlook tells me that im not able to save it as a ppa file - can i send you the ppt file ?

John Wilson
08-27-2009, 01:54 AM
Outlook????

But yes send the ppt file.