View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Need help w using custom image for custom toolbar in Excel 2007

Try something like the following to load a image file as the picture for a
command bar button.

Sub AAA()
Dim Pict As StdPicture
Dim FileName As String
Dim Ctrl As Office.CommandBarButton
FileName = "C:\Path\SomeFile.bmp" '<<< CHANGE
Set Ctrl = Application.CommandBars("Test").Controls(1) '<<< CHANGE
Set Pict = LoadPicture(FileName)
Ctrl.Picture = Pict
End Sub


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




"vbaexperimenter" wrote in
message ...
I created the toolbar as an add in using the method I found at:
http://www.contextures.com/xltoolbar02.html

It is VBA for 2003 but works in 2007. I have found various suggestions
online to add an image, but most of it is using xml, and I'm just using
VB.
Can anyone tell me or direct me where to go to remove the caption name and
replace it with an image?

I found this thread, but I don't know enough about VB to know how to
incorporate it into the code listed on the link above, or if that is even
possible. My educated guess is no since the code I'm using is for the
whole
menu/toolbar and the code from the thread below looks to be refering to 1
button.
http://www.microsoft.com/office/comm...1-d43c814c205b

Any help would be appreciated. FYI, adding the customized toolbar as an
add
in is what I'm looking for, which is why the xml approach didn't seem to
work
well for me.