View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Adding custom faces-icons to toobar buttons.

Guess that's what's great about HTML help, it screws things up even when you
pass it through notepad.

Thanks.
--
Regards,
Tom Ogilvy

"Dave Peterson" wrote in message
...
Wraptext problem:

Option Explicit

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 commandbar
'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



Tom Ogilvy wrote:

In xl2002 and later, the button has a picture property.

The help example:

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 WithEnd SubOr you can use copy , then pasteface.

In
this case, the image would have to be stored on a hidden sheet (for
example). Some other suggestions have been to build a toolbar with the

icons
you want and attach it to the file. Then you can copy the icons from

that
toolbar.-- Regards,Tom Ogilvy"MarkHG"

wrote
in message ups.com...
Hi

I'm developing some addins that have functionality accessed from a
custom toolbar.

I want to be able to add a button to the toolbar with an icon of my

own
- not using one of the built in FaceID's.

Is there an easy way of doing this in code?

I need to be able to generate the Toolbar dynamically depending on
wether the addin is loaded ot not - so manually editing the image, in
the toolbar, which gets persisted in the Excel.xlb file, is not the
ideal solution.

If anybody has worked this out I would be very grateful to here of any
suggestions.

(I have worked out a way of doing it but it is causing other issues
which I can't seem to get around).

Thanks

Mark


--

Dave Peterson