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)