Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default transparent button on custom commandbar

I'm trying to create a toolbar and having the same trouble everyone
does with the button faces. This MS help topic is great:
http://support.microsoft.com/?id=288771
HOWTO: Create a Transparent Picture For Office CommandBar Buttons

It works when you load a picture from a bmp file.:
Set oPic = LoadPicture("c:\testbmp.bmp")

I also tried it by using a bmp loaded into a picturebox.
Set oPic = Picture1.image

But it doesn't work and doesn't give me a transparent button. Any idea
why?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default transparent button on custom commandbar


The reason:
An excel.Picture object is not the same as a stdole.StdPicture


either:

for xl97 (non transparent)
With ctl
Sheet1.Shapes("Icon1").CopyPicture xlScreen, xlBitmap
.PasteFace
End With

for xl2k+

i use an imagelist control on an (empty) userform
to store the 256color bitmaps: the colored picture and the monochrome
mask. The Picture property from an imagelist can be used for icons.


code below is from an addin which needs to be xl97 compatible.

#If VBA6 Then
With ctlWizard
cbr.Protection = msoBarNoProtection
CallByName ctl, "picture", VbLet, _
frmIcons.iml.ListImages("pict").Picture
CallByName ctl, "mask", VbLet, _
frmIcons.iml.ListImages("mask").Picture
End With
Unload frmAbout
#End If


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ckoch wrote :

I'm trying to create a toolbar and having the same trouble everyone
does with the button faces. This MS help topic is great:
http://support.microsoft.com/?id=288771
HOWTO: Create a Transparent Picture For Office CommandBar Buttons

It works when you load a picture from a bmp file.:
Set oPic = LoadPicture("c:\testbmp.bmp")

I also tried it by using a bmp loaded into a picturebox.
Set oPic = Picture1.image

But it doesn't work and doesn't give me a transparent button. Any idea
why?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default transparent button on custom commandbar

Worked perfect with the imagelist. Thanks so much.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default transparent button on custom commandbar



Be aware though Pciture/Mask exist only from
OfficeXP/2003 (doesnot exist for Office 2000/Office97

Sub IconSnippet()
Dim ctl As Office.CommandBarButton
Select Case Val(Application.Version)
Case Is < 10
With ctl
Sheet1.Shapes("Icon1").CopyPicture xlScreen, xlBitmap
.PasteFace
End With
Case 10-11
#If VBA6 Then
CallByName ctl, "picture", VbLet, _
frmIcons.iml.ListImages("Pict1").Picture
CallByName ctl, "mask", VbLet, _
frmIcons.iml.ListImages("Mask1").Picture
End With
Unload frmIcons
#End If
End If



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


ckoch wrote :

Worked perfect with the imagelist. Thanks so much.

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
Creating a Custom commandbar button sifar Excel Programming 7 September 21st 05 07:22 PM
Creating a Custom commandbar button sifar Excel Programming 0 September 15th 05 11:27 PM
Custom Commandbar Stefano Condotta Excel Programming 2 March 3rd 05 07:00 PM
Cannot create transparent XP CommandBar picture jamieuk Excel Programming 0 January 28th 04 05:13 PM
Value of ComboBox on Custom CommandBar Kevin Excel Programming 4 January 15th 04 10:25 PM


All times are GMT +1. The time now is 10:19 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"