Placing Text in a commandbarcontrol

M

Marcel Kollenaar

Hi,

I Know how tp place a FaceId on a button but how do I place some normal text
on a menu bar button? I've also looked at the MVP site but couldn't find
anything about it.

TIA

Marcel
 
C

Cindy M -WordMVP-

Hi Marcel,
I Know how tp place a FaceId on a button but how do I place some normal text
on a menu bar button?
Use the .Caption property of the control. Such code could look something like
this:

Sub AddButton()
Dim cb As Office.CommandBar
Dim cButton As Office.CommandBarButton
Dim cMenu As Office.CommandBarPopup

Set cb = Application.CommandBars("test")
Set cMenu = cb.Controls.Add(Type:=msoControlPopup)
With cMenu
.Caption = "First"
End With
Set cButton = cMenu.CommandBar.Controls.Add(Type:=msoControlButton)
With cButton
.Caption = "Hello"
.OnAction = "ShowMsg"
End With
End Sub


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top