Hello Jill
Set myBar = Application.CommandBars.Add(myName, msoBarTop, , True)
set Myctr = myBar.Controls.Add msoControlButton
Myctr.Caption = "useful info"
HTH
Cordially
Pascal
"jillc" <(E-Mail Removed)> a écrit dans le message de news:
9B7AF605-BCD3-402E-B0E2-(E-Mail Removed)...
>I am trying to add a caption to a control button on a command bar using
>many
> variations of the following code in the Workbook_Open event:
> Set myBar = Application.CommandBars.Add(myName, msoBarTop, , True)
> With myBar
> .Controls.Add msoControlButton
> .Controls(1).Caption = "useful info"
> End With
>
> The command bar shows no button, just blank space, if the mouse hovers
> over
> the space the caption appears, but I want the caption to appear on a
> button
> that a user can press. I can attach the correct macro to the 'space' and
> works if i click the 'space'.
>
> Where am I going wrong?
> --
> Thanks in advance, Jill C