Toolbar Button

  • Thread starter Thread starter Gary Chan
  • Start date Start date
G

Gary Chan

I want to load an icon image (.ico file) to a
CommandBarButton. How can I do this?

I know CommandBarButton has the method "PasteFace", but
this requires the image first copied onto the clipboard. I
don't think (can I?) I can load an .ico file directly to
clipboard.

Any solution?
 
Gary,

In essence, you need to have the icons as an image somewhere and load the
shape. I do this by putting them on a hidden sheet on the workbook that the
commandbar is created from, with code somewhat like

cbTable.Shapes(shapename).CopyPicture
cbCtl.PasteFace

where cbTable is the codename of the sheet containing the picture, shapename
is the name of the shape, such as 'Picture 30', and cbCtl is an object
variable for the control being added.

If you want to use the builtin faceids, you would use something like

cbCtl.FaceId = faceIdNum
 
Thank you for your reply.

but shape object doesn't seem to take .ico files but just
bmp files.

I have problem with bmp files because when I load a bmp
file (by converting from a ico file) to a commandbarbutton
the icon is blurred (probably this is a bug)
 
Hi Gary,
See my page
http://www.mvps.org/dmcritchie/excel/toolbars.htm#ico
I redid the area after finding that there was a bad link so you
have at least one choice now.

to get the image to the clipboard such as for Excel toolbar use, this one works for me
Icon Sucker 2
http://www.copseystrain.com/iconsucker/index.

to create a file such as for documentation in HTML
IconXTractor 2.304,
http://home.tiscali.de/kurtzimmermann/iconxtractor_e.htm

With both of the above you have to go through the file directories,
you cannot directly paste the directory you want when you specify the file.
 
Bob,

Do you have a "loose trigger finger" or a problem with Outlook (no pun
intended). Many of your posts are preceded with a blank response...
 
Back
Top