Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Custom Button Images

Good approach. You can even pick any button on the toolbar.
--
Gary''s Student - gsnu200727


"Pflugs" wrote:

I have found a way. After a few more hours of digging, I found this example
in the help menu:

Sub ChangeButtonImage()
Dim picPicture As IPictureDisp
Dim picMask As IPictureDisp

Set picPicture = stdole.StdFunctions.LoadPicture( _
"c:\images\picture.bmp")
Set picMask = stdole.StdFunctions.LoadPicture( _
"c:\images\mask.bmp")

'Reference the first button on the first command bar
'using a With...End With block.
With Application.CommandBars.FindControl(msoControlButt on)
'Change the button image.
.Picture = picPicture

'Use the second image to define the area of the
'button that should be transparent.
.Mask = picMask
End With
End Sub

Thus, to complete my company add-in, I will program code to create a custom
toolbar and menu, and then the code will load the pictures from a company
shared folder. I think that will work nicely.

Thanks for helping me!
Pflugs

"Gary''s Student" wrote:

I see. Since it is easy to change the toolbar button images manually, it can
be done with VBA. The Macro Recorder won't help. I'll investgate and update
this tomorrow.
--
Gary''s Student - gsnu200727


"Pflugs" wrote:

That's interesting and useful, but I really want to change the image of a
toolbar or menu button, not a forms or controls button. Do you know of any
way to do this using VBA?

Thanks,
Pflugs

"Gary''s Student" wrote:

If you create the button with the Controls toolbox rather than forms, then
right-click the button and select Properties. Go down to picture, select it
and pick a picture from the resulting dialog box
--
Gary''s Student - gsnu200727


"Pflugs" wrote:

I know how to create custom toolbars and menus, but I want to design my own
button images (say in Paint or Photoshop) and attach those to my custom
commands. I found this site:

http://www.vertex42.com/ExcelTips/ex...r-buttons.html

that shows how to download GIF files and paste the image to a button or menu
item. Is this possible programmatically? Or can I set a button image from a
file when I create the menu from my VBA code?

Thanks,
Pflugs

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export custom Macro Button Images RWN Setting up and Configuration of Excel 1 November 26th 06 11:52 AM
Export custom Macro Button Images RWN Excel Discussion (Misc queries) 1 November 26th 06 10:53 AM
Referencing custom images within formulas...some help Corey Helms Excel Discussion (Misc queries) 0 July 21st 06 07:43 PM
Button Images Simon Shaw[_5_] Excel Programming 2 January 10th 05 03:14 PM
How to add images to custom toolbar buttons? RADO[_3_] Excel Programming 3 November 1st 03 05:07 PM


All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"