Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dean,
Here is an example of a menu on the main Excel menu 'If you put code in the appropriate workbook open event, and 'delete it in the close it will exist only for that workbook. 'Here is an example of a building a commandbar on the fly 'when you open a workbook. It adds a sub-menu to the Tools menu. Private Sub Workbook_Open() Dim oCb As CommandBar Dim oCtl As CommandBarPopup Dim oCtlBtn As CommandBarButton Set oCb = Application.CommandBars("Worksheet Menu Bar") Set oCtl = oCb.Controls.Add(Type:=msoControlPopup, temporary:=True) With oCtl .Caption = "myMenu" Set oCtlBtn = .Controls.Add( _ Type:=msoControlButton, _ temporary:=True) oCtlBtn.Caption = "myMacroButton" oCtlBtn.FaceId = 161 oCtlBtn.OnAction = "myMacro" Set oCtlBtn = .Controls.Add( _ Type:=msoControlButton, _ temporary:=True) oCtlBtn.Caption = "myMacroButton2" oCtlBtn.FaceId = 161 oCtlBtn.OnAction = "myMacro2" 'etc. End With End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim oCb As CommandBar Set oCb = Application.CommandBars("Worksheet Menu Bar") oCb.Controls("myMeny").Delete End Sub 'To add this, go to the VB IDE (ALT-F11 from Excel), and in 'the explorer pane, select your workbook. Then select the 'ThisWorkbook object (it's in Microsoft Excel Objects which 'might need expanding). Double-click the ThisWorkbook and 'a code window will open up. Copy this code into there, 'changing the caption and action to suit. 'This is part of the workbook, and will only exist with the 'workbook, but will be available to anyone who opens the 'workbook. -- HTH RP (remove nothere from the email address if mailing direct) "Grace" wrote in message ... I have created several macros that I want someone else, who is not that well-versed, to be able to run easily, over and over. I am afraid to just assign keyboard controls with a letter (such as cntrl-a), or such things, as they might inadvertently trigger a macro when they are just typing stuff in. So, something I recall seeing, but don't recall how to set-up, is that the name of selected (though not all, I hope) macros appear on the Tools dropdown within EXCEL. Even better, if easy to do, would be the clickable buttons you can put on a worksheet and click to initiate macros, - but if that's tricky, I don't need that now. Can someone tell me how this is done, please? Thanks much Dean |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
all sheets need the same first 6 columns - user friendly presentat | Excel Discussion (Misc queries) | |||
Making a Form for User-friendly Macros? | Excel Discussion (Misc queries) | |||
User-friendly lookup solutions needed | Excel Discussion (Misc queries) | |||
I need a user friendly route sheet! Help! :} | New Users to Excel | |||
user friendly filter | Excel Programming |