ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   personal commandbars (https://www.excelbanter.com/excel-programming/315774-personal-commandbars.html)

Jackie

personal commandbars
 
Is it possible to have icons on the personalized toolbars instead of "text"?
As in the following sample, how to replace the text "internet" under caption
with a small icon image "such as internet.bmp or gif or jpeg"


Set myControl =
Application.ActiveExplorer.CommandBars("ToolbarOL" ).Controls.Add(Type:=msoControlButton)
With myControl
.Caption = "internet"
.Visible = True
.OnAction = "GetOnline"
.Style = msoButtonCaption
End With

--
Thanks.

Dick Kusleika[_4_]

personal commandbars
 
Jackie

Here's an example

With .Controls.Add(Type:=msoControlButton, befo=.Controls.Count +
1)
.Caption = "Trim Google URL"
.TooltipText = .Caption
.OnAction = "Myfunctions.xla!Module2.ShowTrim"
.Visible = True
Sheet2.Shapes("Picture 1").Copy
.PasteFace
End With

The icon is stored as a picture on Sheet2 and is copied. PasteFace is used
to apply the icon to the commandbarbutton. Don't set the Style or set it as
msoButtonIcon to get the icon to show instead of text. The example comes
from here

http://www.dicks-blog.com/excel/2004..._commandb.html

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Jackie" wrote in message
...
Is it possible to have icons on the personalized toolbars instead of

"text"?
As in the following sample, how to replace the text "internet" under

caption
with a small icon image "such as internet.bmp or gif or jpeg"


Set myControl =

Application.ActiveExplorer.CommandBars("ToolbarOL" ).Controls.Add(Type:=msoCo
ntrolButton)
With myControl
.Caption = "internet"
.Visible = True
.OnAction = "GetOnline"
.Style = msoButtonCaption
End With

--
Thanks.





All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com