Customizing a toolbar wit new icons

A

avi

Hello,

I've seen some third party applications in Excel that create a toolbar
with icons that differ from the faceids provided by Excel

Do you know how is it possible to create such toolbars?

Thanks a lot
Avi
 
C

Chip Pearson

There are basically two ways to do this. You can load a picture from
an external file or you can embed a picture on a worksheet.

Using an external file:
===============
Sub AAA()
Dim Btn As Office.CommandBarButton
Set Btn = Application.CommandBars("Standard"). _
Controls.Add(Type:=msoControlButton, temporary:=True)
With Btn
.Picture = LoadPicture("C:\TestPic.bmp")
.OnAction = "Clicked"
End With
End Sub


Using an embedded picture:
=====================
Sub BBB()
Dim P As Excel.Picture
Dim Btn As Office.CommandBarButton
Set P = Worksheets("Sheet1").Pictures("ThePict")
P.CopyPicture xlScreen, xlBitmap
Set Btn = Application.CommandBars("Standard"). _
Controls.Add(Type:=msoControlButton, temporary:=True)
With Btn
.PasteFace
.OnAction = "Clicked"
End With
End Sub


Both of these procedures will create a new button on the Standard
command bar and apply the picture to the button.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
 

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