Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Is it possible? I'd like to make one where you can open up various submenus, and eventually select an option that has a macro attached....(like eg the 'all programs' menu that branches off the 'start' option on windows. SURELY that's possible! Cheers, Tom -- TAL27 ------------------------------------------------------------------------ TAL27's Profile: http://www.excelforum.com/member.php...o&userid=30145 View this thread: http://www.excelforum.com/showthread...hreadid=498749 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Here is an example
Option Explicit '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") With oCb Set oCtl = .Controls("Tools").Controls.Add( _ Type:=msoControlPopup, _ temporary:=True) oCtl.Caption = "myButton" With oCtl Set oCtlBtn = .Controls.Add( _ Type:=msoControlButton, _ temporary:=True) oCtlBtn.Caption = "myMacroButton" oCtlBtn.FaceId = 161 oCtlBtn.OnAction = "myMacro" End With With oCtl Set oCtlBtn = .Controls.Add( _ Type:=msoControlButton, _ temporary:=True) oCtlBtn.Caption = "myMacroButton2" oCtlBtn.FaceId = 161 oCtlBtn.OnAction = "myMacro2" End With '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("Tools").Controls("myButton").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 Bob Phillips (remove nothere from email address if mailing direct) "TAL27" wrote in message ... Is it possible? I'd like to make one where you can open up various submenus, and eventually select an option that has a macro attached....(like eg the 'all programs' menu that branches off the 'start' option on windows. SURELY that's possible! Cheers, Tom -- TAL27 ------------------------------------------------------------------------ TAL27's Profile: http://www.excelforum.com/member.php...o&userid=30145 View this thread: http://www.excelforum.com/showthread...hreadid=498749 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Thanks Bob - have copied in the code you gave, but can't really see what difference it has made. Has something appeared on the Tools menu? I can't see a new option? Cheers, Tom PS sorry about late reply - haven't been able to access internet lately. -- TAL27 ------------------------------------------------------------------------ TAL27's Profile: http://www.excelforum.com/member.php...o&userid=30145 View this thread: http://www.excelforum.com/showthread...hreadid=498749 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 FAILS, but Excel 2000 SUCCEEDS ??? | Excel Discussion (Misc queries) | |||
create menus in excel worksheet | Excel Worksheet Functions | |||
Making A Databse system on Excel? | Excel Discussion (Misc queries) | |||
Making text all CAPS in excel | Excel Worksheet Functions | |||
how do you create drop down menus for individual cells in excel? | Excel Worksheet Functions |