View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dan[_20_] Dan[_20_] is offline
external usenet poster
 
Posts: 4
Default Add control to commandbar

Hi all

1. I want to add a control before "&Fill Color" on the
Formatting commandbar. I'm stuck and frustrated!

In this effort "After:=FontCtrl" is clearly wrong

Sub Test()
Dim FontCtrl As Object
With Application.CommandBars("Formatting")
Set FontCtrl = .FindControl(Id:=1691)
'1691 is Fill Color ID
'MsgBox FontCtrl.Caption
.Controls.Add(Type:=msoControlButton, _
after:=FontCtrl).Caption = "MyCaption" 'fails
'also .OnAction, .Tag etc
End With
End Sub

2. I've noticed some customized toolbars extend to the
right of the screen. What would be the best approach to
ensure I am neither putting my new control, nor pushing
any others off the screen.

TIA,
Dan