Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I cannot find a way to paste an image into a now toolbar icon using VB
macros. I create a toolbar button when I open a particular spreadsheet, and I destroy it when I close the worksheet. In this way, my toolbar is customized to the spreadsheet. But again I could not find a way to paste a new icon onto the button using macros. Any help is appreciated. Please reply to the group. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub ChangeIcon()
Dim cb1 As CommandBarButton Dim cBar As CommandBar Set cBar = Application.CommandBars("Your Toolbar") Set cb1 = cBar.Controls(Index of your control) cb1.Picture = UserForm2.Image1.Picture 'or whatever picture you want to assign End Sub HTH Die_Another_Day |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In all versions, if the icon is in the clipboard, then use pasteface. If it
isn't in the clipboard, then copy it first. In xl2003 you can use the Picture property of the commandbarbutton. From the help on that property: 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 -- Regards, Tom Ogilvy "Gregory Kip" wrote: I cannot find a way to paste an image into a now toolbar icon using VB macros. I create a toolbar button when I open a particular spreadsheet, and I destroy it when I close the worksheet. In this way, my toolbar is customized to the spreadsheet. But again I could not find a way to paste a new icon onto the button using macros. Any help is appreciated. Please reply to the group. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you both -- it works great, even in MS Project!
"Gregory Kip" wrote in message ... I cannot find a way to paste an image into a now toolbar icon using VB macros. I create a toolbar button when I open a particular spreadsheet, and I destroy it when I close the worksheet. In this way, my toolbar is customized to the spreadsheet. But again I could not find a way to paste a new icon onto the button using macros. Any help is appreciated. Please reply to the group. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Drawing toolbar Icon | Excel Worksheet Functions | |||
toolbar icon description | New Users to Excel | |||
Icon in toolbar | Excel Programming | |||
Add Icon to Toolbar | Excel Programming | |||
icon in menu toolbar | Excel Programming |