
Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
Helmut Weber was telling us:
Helmut Weber nous racontait que :
> Hi Jean-Guy,
>
[quoted text clipped - 34 lines]
>
> I am confused.
Hi Helmut,
I am not sure what you mean by "mouse pointer rests on that button" and I am
not convinced it is relevant in this case.
The UI uses "Name", but in fact it is the .Caption property in the object
library.
I created a toolbar called "Test".
I added a new menu called "test90a"
(All of this through the "Customize" dialog)
Then I used the code you posted:
With CommandBars("Test")
.Controls("test90a").Caption = "test90b"
End With
and everything worked as expected.
Then, to make sure, I used
With CommandBars("Test")
.Controls("test90b").Caption = "MoreTest"
End With
and it worked again.
Then, I tried again, but this tine, instead of a "New menu" type of control,
I added an Autotext type of button and used
With CommandBars("Test")
.Controls("Greetings").Caption = "NewName"
End With
and everything again worked as expected.
I am not sure how you got "xxx" in the dialog, but "test90a" displayed on
the toolbar.
Never seen that behaviour before, whatever name you type under name is in
fact the .Caption property that ends up being displayed in the UI.
Finally, I did as I wrote above to create a toolbar with a new menu, but
this time I added a button under that menu, again an Autotext.
So, I now had a toolbar called "Test", a menu called "NewName" and under
that menu a button called "RE :".
Using
With CommandBars("Test").Controls("NewName").CommandBar
.Controls("RE :").Caption = "NewButtonName"
End With
I changed the name/caption of the button under the menu.
No errors...
So I am not sure how I can shed more light or help clarify your confusion...

Signature
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Helmut Weber - 10 Feb 2006 22:57 GMT
Hi Jean-Guy,
thanks a lot.
I hope, you didn't waste to much time on it.
>I am not sure what you mean by "mouse pointer rests on that button"
>and I am not convinced it is relevant in this case.
It's the TooltipText, as I've found out in the meantime.
And that's what is displayed,
if "default style" is checked in the customize dialog,
not the caption.
>The UI uses "Name",
>but in fact it is the .Caption property in the object library.
That was the main point I wanted to have to have clarified.
Still, for built-in buttons on built-in toolbars,
the tooltiptext displays the name (or caption).
Maybe unless tooltiptext it is changed explicitly.
Whereas for a custom button on a custom toolbar,
the tooltiptext doesn't change with a change of the caption (or name).
One lazy sunday afternoon I'll look more deeply into it.
Thanks again.

Signature
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"