CommandBar Button pictures

  • Thread starter Thread starter Vyyk Drago
  • Start date Start date
V

Vyyk Drago

Hi

I am trying to use the sample code from the Outlook 2002
helpfile regarding button pictures. I have created
picture files with the correct path and names as per the
code, but it does not place a picture on my buttons.

Are there any specific criteria the bitmaps should adhere
to in order to workl properly?, e.g. the size, colours
used, etc.? Below is the code I am using.

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
(msoControlButton)
'Change the button image.
.Picture = picButton

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


Any help will be greatly appreciated.
Many thanks and kind regards
Vyyk
 
Picture and Mask must be set by reference, try to change your code to

Set .Picture = picButton
Set .Mask = picMask

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Back
Top