R
Ruskin Hardie
I am creating a custom command bar, with a button. This works fine;
Const BAR_NAME As String = "TEST"
Dim objButton As CommandBarControl
Dim objToolbar As CommandBar
If Not CommandBars(BAR_NAME) Is Nothing Then CommandBars(BAR_NAME).Delete
Set objToolbar = CommandBars.Add(Name:=BAR_NAME, Position:=1,
Temporary:=True)
objToolbar.Visible = True
objToolbar.Postion = msoBarTop
Set objButton = CommandBars(BAR_NAME).Controls.Add(Type:=msoControlButton)
objButton.TooltipText = "click here to update your data"
objButton.Style = msoButtonIcon
objButton.FaceId = 44
However, I have a problem, in that I want the buttons on this custom command
bar, to be larger (so it shows up more readily). There is a 'LargeButtons'
property, but that is of the CommandBars object. If I set this property to
'True', then all buttons (on the standard toolbars) are large as well, as it
applies to the CommandBars collection object.
I thought of trying something like;
Dim objControls As CommandBars
Dim objBar As CommandBar
Set objBar = Application.CommandBars(BAR_NAME)
'Append the command bar to the command bars collection ??
objControls.LargeButtons = True
This returns a 'CommandBar', now how do I append this command bar object to
the command bars collection or is there another way, to make the icons stand
out more? I have also tried, setting the style property of the
commandbarcontrol to msoButtonCaption and the Caption property to some text,
but I can't change the text format (ie: make it larger or bold).
Const BAR_NAME As String = "TEST"
Dim objButton As CommandBarControl
Dim objToolbar As CommandBar
If Not CommandBars(BAR_NAME) Is Nothing Then CommandBars(BAR_NAME).Delete
Set objToolbar = CommandBars.Add(Name:=BAR_NAME, Position:=1,
Temporary:=True)
objToolbar.Visible = True
objToolbar.Postion = msoBarTop
Set objButton = CommandBars(BAR_NAME).Controls.Add(Type:=msoControlButton)
objButton.TooltipText = "click here to update your data"
objButton.Style = msoButtonIcon
objButton.FaceId = 44
However, I have a problem, in that I want the buttons on this custom command
bar, to be larger (so it shows up more readily). There is a 'LargeButtons'
property, but that is of the CommandBars object. If I set this property to
'True', then all buttons (on the standard toolbars) are large as well, as it
applies to the CommandBars collection object.
I thought of trying something like;
Dim objControls As CommandBars
Dim objBar As CommandBar
Set objBar = Application.CommandBars(BAR_NAME)
'Append the command bar to the command bars collection ??
objControls.LargeButtons = True
This returns a 'CommandBar', now how do I append this command bar object to
the command bars collection or is there another way, to make the icons stand
out more? I have also tried, setting the style property of the
commandbarcontrol to msoButtonCaption and the Caption property to some text,
but I can't change the text format (ie: make it larger or bold).