Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adjusting individual icon size in commandbars?
Hi!
I'm trying to create a commandbar in excel using VBA and it works fine. It's just that every picture I try to assign to the iconface always shrinks to a predestined size. It's possible to change the size of the button itself (using commandbarcontrol.width or height), but not the image! Anyone got a suggestion? /David N |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adjusting individual icon size in commandbars?
The icon size is fixed. The button size can be stretched somewhat, though I
can't remember not using the default. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ wrote in message oups.com... Hi! I'm trying to create a commandbar in excel using VBA and it works fine. It's just that every picture I try to assign to the iconface always shrinks to a predestined size. It's possible to change the size of the button itself (using commandbarcontrol.width or height), but not the image! Anyone got a suggestion? /David N |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adjusting individual icon size in commandbars?
Hello David, Here is a technique that works with Excel 2000. Insert the picture you what displayed as the button face onto the worksheet. Right click the picture and Copy it. Now, run the macro that creates your commandbar button and have the ..PasteFace method in the code. Below is a code example for a temporary command button... Code: -------------------- Sub AddButton() Dim CmdBar As CommandBar Dim CmdBtn As CommandBarButton Set CmdBar = Excel.CommandBars("Worksheet Menu Bar") CmdBar.Controls.Add Type:=msoControlButton, ID:=1, Temporary:=True Set CmdBtn = CmdBar.Controls(CmdBar.Controls.Count) With CmdBtn .Caption = "Test" .Style = msoButtonIconAndCaption .Visible = True .PasteFace End With End Sub -------------------- The copied picture will be resized automatically to fit your button. Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=557677 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Adjusting individual icon size in commandbars?
Leith Ross skrev: Hello David, Here is a technique that works with Excel 2000. Insert the picture you what displayed as the button face onto the worksheet. Right click the picture and Copy it. Now, run the macro that creates your commandbar button and have the .PasteFace method in the code. Below is a code example for a temporary command button... Code: -------------------- Sub AddButton() Dim CmdBar As CommandBar Dim CmdBtn As CommandBarButton Set CmdBar = Excel.CommandBars("Worksheet Menu Bar") CmdBar.Controls.Add Type:=msoControlButton, ID:=1, Temporary:=True Set CmdBtn = CmdBar.Controls(CmdBar.Controls.Count) With CmdBtn .Caption = "Test" .Style = msoButtonIconAndCaption .Visible = True .PasteFace End With End Sub -------------------- The copied picture will be resized automatically to fit your button. Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=557677 Hi! I tried your code but it doesn't seem to work. The picture shrinks down to the standard icon size no matter what size the button is. What am I doing wrong? /David |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Adjusting Column Size | Excel Discussion (Misc queries) | |||
automatical cell size adjusting | Excel Discussion (Misc queries) | |||
Adjusting comment box size by Macro | Excel Discussion (Misc queries) | |||
adjusting cell size in spreadsheets | Excel Discussion (Misc queries) | |||
Toolbar Icon Size | Excel Programming |