PC Review


Reply
Thread Tools Rate Thread

CommandBar Button pictures

 
 
Vyyk Drago
Guest
Posts: n/a
 
      4th Mar 2004
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
 
Reply With Quote
 
 
 
 
Dmitry Streblechenko \(MVP\)
Guest
Posts: n/a
 
      4th Mar 2004
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


"Vyyk Drago" <(E-Mail Removed)> wrote in message
news:430b01c40202$78659590$(E-Mail Removed)...
> 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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add button to commandbar to all workbooks within xla Franck Microsoft Excel Discussion 3 6th Oct 2005 06:29 AM
static commandbar Button =?Utf-8?B?SGFyaQ==?= Microsoft Excel Programming 0 22nd Jun 2004 10:50 AM
CommandBar Button parameters Bill D. Microsoft Excel Programming 3 26th Mar 2004 06:13 PM
CommandBar button events Stee Microsoft Powerpoint 0 7th Jan 2004 12:46 PM
Add an image to a commandbar button Marc Microsoft Outlook Program Addins 3 27th Nov 2003 09:33 PM


Features
 

Advertising
 

Newsgroups
 


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