View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
[email protected] davno568@hotmail.com is offline
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