How to load image onto CommandBarButton?

  • Thread starter Ken Kee via OfficeKB.com
  • Start date
K

Ken Kee via OfficeKB.com

I am creating a Word COM-addin using C#. I am able to load my button with
text onto the Word toolbar selection. My button is an object type of
CommandBarButton. The way I construct the button as

MyButton = (CommandBarButton) oStandardBar.Controls.Add(1, omissing ,
omissing , omissing , omissing);
MyButton.Caption = "Test Button";
MyButton.Style = MsoButtonStyle.msoButtonCaption;

Since I am relatively new in developing Word COM-addin application, the
question is: how can I modify my MyButton object to load with an image
instead of text. I was searching on MSDN for the CommandBarButton class, I
was not able to get much help.

Thanks.
 
P

Perry

Excel guru John Walkenbach has a neat tool with which you can select a
commandbarbutton image, also called: faceid
http://www.j-walk.com/ss/excel/tips/tip67.htm

MyButton.Caption = "Test Button";
MyButton.Style = MsoButtonStyle.msoButtonCaption;
MyButton.FaceID = [here the value of the selected by above tool]

Krgrds,
Perry
 
K

Ken Kee via OfficeKB.com

Thanks for your reply. Can I use a custom made image? How can I use it,
thanks.
 

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