Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have written myself a macro which designs a command bar. Unfortunately I
can't work out how to tell it to show text as well as icons. Any ideas? Many Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Neil,
You need to set the individual button's style property to : msoButtonIconAndCaption Here is a simple VBA help custom toolbar which I have adapted to give one button a text display and another a text and icon display: Sub TestBar() Dim customBar As CommandBar Dim newButton As CommandBarButton Set customBar = CommandBars.Add("Custom2") Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Cut").ID) Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Copy").ID) newButton.Style = msoButtonIconAndCaption Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Paste").ID) newButton.Style = msoButtonCaption customBar.Visible = True End Sub --- Regards, Norman "Neil Hopkinson" wrote in message ... I have written myself a macro which designs a command bar. Unfortunately I can't work out how to tell it to show text as well as icons. Any ideas? Many Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Excellent, thanks very much
"Norman Jones" wrote: Hi Neil, You need to set the individual button's style property to : msoButtonIconAndCaption Here is a simple VBA help custom toolbar which I have adapted to give one button a text display and another a text and icon display: Sub TestBar() Dim customBar As CommandBar Dim newButton As CommandBarButton Set customBar = CommandBars.Add("Custom2") Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Cut").ID) Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Copy").ID) newButton.Style = msoButtonIconAndCaption Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Paste").ID) newButton.Style = msoButtonCaption customBar.Visible = True End Sub --- Regards, Norman "Neil Hopkinson" wrote in message ... I have written myself a macro which designs a command bar. Unfortunately I can't work out how to tell it to show text as well as icons. Any ideas? Many Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Neil,
Or better, in case the toolbar exists or the procedure is run multiple times: Sub TestBar() Dim customBar As CommandBar Dim newButton As CommandBarButton On Error Resume Next CommandBars("MyDemoBar").Delete On Error GoTo 0 Set customBar = CommandBars.Add("MyDemoBar") Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Cut").ID) Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Copy").ID) newButton.Style = msoButtonIconAndCaption Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Paste").ID) newButton.Style = msoButtonCaption customBar.Visible = True End Sub --- Regards, Norman "Norman Jones" wrote in message ... Hi Neil, You need to set the individual button's style property to : msoButtonIconAndCaption Here is a simple VBA help custom toolbar which I have adapted to give one button a text display and another a text and icon display: Sub TestBar() Dim customBar As CommandBar Dim newButton As CommandBarButton Set customBar = CommandBars.Add("Custom2") Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Cut").ID) Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Copy").ID) newButton.Style = msoButtonIconAndCaption Set newButton = customBar.Controls _ .Add(msoControlButton, CommandBars("Edit") _ .Controls("Paste").ID) newButton.Style = msoButtonCaption customBar.Visible = True End Sub --- Regards, Norman "Neil Hopkinson" wrote in message ... I have written myself a macro which designs a command bar. Unfortunately I can't work out how to tell it to show text as well as icons. Any ideas? Many Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
programming command bars | Excel Discussion (Misc queries) | |||
Command Bars | Excel Discussion (Misc queries) | |||
Command Bars | Excel Programming | |||
command bars | Excel Programming | |||
Attaching Command Bars to Add-IN | Excel Programming |