PC Review


Reply
Thread Tools Rate Thread

Change toolbar icon in VBA

 
 
Paul
Guest
Posts: n/a
 
      29th Oct 2009
I want to set a collection of icons into a toolbar, but I want to use
specific icon images.

How do I set them in VBA ?
Is there a list of the icon ID's with their images I can select from ?
(again set in VBA)
Can I use external icon files ?
 
Reply With Quote
 
 
 
 
Sam Wilson
Guest
Posts: n/a
 
      29th Oct 2009
Hi,

If you want to use built in ones, you need to look at "FaceId" in help.
There are absolutely thousands of them... This will show them all, but it's
not fast.

Sub faces()

Dim i As Integer
Dim cont As CommandBarControl
Dim bar As CommandBar

On Error GoTo catcher

Application.ScreenUpdating = False
Set bar = CommandBars.Add(Position:=msoBarFloating, MenuBar:=False,
temporary:=True)
Set cont = bar.Controls.Add(Type:=msoControlButton, temporary:=True)

Do
cont.FaceId = i
cont.CopyFace
ActiveSheet.Paste Cells(i + 1, 1)
i = i + 1
Loop

catcher:
If Err.Number = 1004 Then Resume Next
bar.Delete

End Sub

you can set them in your code by declaring a commandbarcontrol and then
setting its faceid property.

Sam


"Paul" wrote:

> I want to set a collection of icons into a toolbar, but I want to use
> specific icon images.
>
> How do I set them in VBA ?
> Is there a list of the icon ID's with their images I can select from ?
> (again set in VBA)
> Can I use external icon files ?

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change icon on quick access toolbar april Microsoft Excel Misc 6 21st Oct 2009 08:49 PM
how change toolbar text to icon lemonscented Microsoft Outlook Discussion 1 4th Dec 2007 06:27 AM
Change Toolbar Icon to Text =?Utf-8?B?U2t5Zmx5ZXI=?= Microsoft Word Document Management 4 2nd Jul 2007 07:01 AM
How do I change a icon on the quick launch toolbar? =?Utf-8?B?TW9uaXF1ZQ==?= Microsoft Word Document Management 2 13th Feb 2006 10:36 AM
Change toolbar icon in vba petrucci Microsoft Access 3 25th Jan 2006 10:01 AM


Features
 

Advertising
 

Newsgroups
 


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