Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Create toolbar
Hi,
I use the following code to create a toolbar: Sub CreateMenubar() Dim iCtr As Long Dim MacNames As Variant Dim CapNamess As Variant Dim TipText As Variant Call RemoveMenubar MacNames = Array("Line", _ "Column", _ "Pie", _ "LineColumn1", _ "LineColumn2", _ "Scatter", _ "StackedColumn") CapNamess = Array("Line", _ "Column", _ "Pie", _ "LineColumn1", _ "LineColumn2", _ "Scatter", _ "StackedColumn") TipText = Array("Line chart", _ "Column chart", _ "Pie chart", _ "Line/column 1 axis", _ "Line/column 2 axis", _ "Scatter chart", _ "Stacked column chart") With Application.CommandBars.Add .Name = ToolBarName .Left = 200 .Top = 200 .Protection = msoBarNoProtection .Visible = True .Position = msoBarFloating For iCtr = LBound(MacNames) To UBound(MacNames) With .Controls.Add(Type:=msoControlButton) .OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr) .Caption = CapNamess(iCtr) .Style = msoButtonIconAndCaption .FaceId = 71 + iCtr .TooltipText = TipText(iCtr) End With Next iCtr End With End Sub This code creates a toolbar with 7 buttons that control other macros. I see now that I will need more buttons, up to 25 or 30 and I would like to group them under menus on the toolbar, such as "Lines", "Columns" etc. Is there an easy way to adjust the current code to accomodate this? -- Fredrik E. Nilsen |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Create toolbar
The first example on this page shows how to group commandbar items into
submenus on the commandbar. http://peltiertech.com/Excel/menus.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Fredrik E. Nilsen" wrote in message ... Hi, I use the following code to create a toolbar: Sub CreateMenubar() Dim iCtr As Long Dim MacNames As Variant Dim CapNamess As Variant Dim TipText As Variant Call RemoveMenubar MacNames = Array("Line", _ "Column", _ "Pie", _ "LineColumn1", _ "LineColumn2", _ "Scatter", _ "StackedColumn") CapNamess = Array("Line", _ "Column", _ "Pie", _ "LineColumn1", _ "LineColumn2", _ "Scatter", _ "StackedColumn") TipText = Array("Line chart", _ "Column chart", _ "Pie chart", _ "Line/column 1 axis", _ "Line/column 2 axis", _ "Scatter chart", _ "Stacked column chart") With Application.CommandBars.Add .Name = ToolBarName .Left = 200 .Top = 200 .Protection = msoBarNoProtection .Visible = True .Position = msoBarFloating For iCtr = LBound(MacNames) To UBound(MacNames) With .Controls.Add(Type:=msoControlButton) .OnAction = "'" & ThisWorkbook.Name & "'!" & MacNames(iCtr) .Caption = CapNamess(iCtr) .Style = msoButtonIconAndCaption .FaceId = 71 + iCtr .TooltipText = TipText(iCtr) End With Next iCtr End With End Sub This code creates a toolbar with 7 buttons that control other macros. I see now that I will need more buttons, up to 25 or 30 and I would like to group them under menus on the toolbar, such as "Lines", "Columns" etc. Is there an easy way to adjust the current code to accomodate this? -- Fredrik E. Nilsen |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create a toolbar button | Excel Programming | |||
Create Toolbar with VBA | Excel Programming | |||
Create a Temp Toolbar | Excel Programming | |||
how to create toolbar? | Excel Programming | |||
Create toolbar-help | Excel Programming |