Need help w using custom image for custom toolbar in Excel 2007

Need help w using custom image for custom toolbar in Excel 2007

Post by dmJhZXhwZX » Sat, 21 Jun 2008 05:58:05

I created the toolbar as an add in using the method I found at:
http://www.yqcomputer.com/

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.yqcomputer.com/ +image&lang=en&cr=US&guid=&sloc=en-us&dg=microsoft.public.excel.programming&p=1&tid=53348cbc-0a44-4a39-a6f8-e2515b0d3fbd&mid=6b6bc178-6758-47b0-a231-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.

 
 
 

Need help w using custom image for custom toolbar in Excel 2007

Post by Chip Pears » Sat, 21 Jun 2008 07:06:54

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" < XXXX@XXXXX.COM > wrote in