Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
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
Adjusting Column Size carol Excel Discussion (Misc queries) 4 July 17th 08 06:45 PM
automatical cell size adjusting ninjaneer Excel Discussion (Misc queries) 4 April 21st 08 10:13 PM
Adjusting comment box size by Macro yshridhar Excel Discussion (Misc queries) 2 February 5th 08 09:19 AM
adjusting cell size in spreadsheets [email protected] Excel Discussion (Misc queries) 5 December 21st 05 05:59 PM
Toolbar Icon Size Rob Excel Programming 2 January 30th 05 07:48 PM


All times are GMT +1. The time now is 01:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"