Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 238
Default Custom CommandBars

Here is a simple one button menu bar. How do I add a custom image to
replace the face ID? I can't find a good web reference for this.


Sub CreateMenr()
On Error Resume Next
Application.CommandBars("example").Delete
Set myCB = CommandBars.Add(Name:="example",
Position:=msoBarFloating)

' Add a button to this bar
Set myCBtn2 = myCB.Controls.Add(Type:=msoControlButton)
With myCBtn2
.FaceId = 17 ' <- Face Id 17 is a barchart icon
.Caption = "Descriptive stat"
End With
myCB.Visible = True
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Custom CommandBars

try it:

Sub CreateMenu()
On Error Resume Next
Application.CommandBars("example").Delete
Set myCB = CommandBars.Add(Name:="example",
Position:=msoBarFloating)

' Add a button to this bar
Set myCBtn2 = myCB.Controls.Add(Type:=msoControlButton)
Set menu3 = myCBtn2.CommandBar.Controls _
..Add(Type:=msoControlButton, ID:=1)
menu3.Caption = "Descriptive stat"
menu3.OnAction = "Your action"
menu3.FaceId = 17
myCB.Visible = True
End Sub

"Fan924" a écrit dans le message de news:
...
Here is a simple one button menu bar. How do I add a custom image to
replace the face ID? I can't find a good web reference for this.


Sub CreateMenr()
On Error Resume Next
Application.CommandBars("example").Delete
Set myCB = CommandBars.Add(Name:="example",
Position:=msoBarFloating)

' Add a button to this bar
Set myCBtn2 = myCB.Controls.Add(Type:=msoControlButton)
With myCBtn2
.FaceId = 17 ' <- Face Id 17 is a barchart icon
.Caption = "Descriptive stat"
End With
myCB.Visible = True
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 238
Default Custom CommandBars

How does this add a custom image?
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Custom CommandBars


cbTable.Shapes(shapename).Copy*Picture
cbCtl.PasteFace

where cbTable is the codename of the sheet containing the picture, shapename
is the name of the shape, such as 'Picture 30', and cbCtl is an object
variable for the control being added.



--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Fan924" wrote in message
...
Here is a simple one button menu bar. How do I add a custom image to
replace the face ID? I can't find a good web reference for this.


Sub CreateMenr()
On Error Resume Next
Application.CommandBars("example").Delete
Set myCB = CommandBars.Add(Name:="example",
Position:=msoBarFloating)

' Add a button to this bar
Set myCBtn2 = myCB.Controls.Add(Type:=msoControlButton)
With myCBtn2
.FaceId = 17 ' <- Face Id 17 is a barchart icon
.Caption = "Descriptive stat"
End With
myCB.Visible = True
End Sub



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
Adding and Deleting custom commandbars whylite Excel Programming 3 September 10th 07 06:14 PM
CommandBars & Custom John JBM Excel Programming 1 May 16th 07 05:44 PM
Bulk-Delete All Custom Commandbars KL[_6_] Excel Programming 4 December 10th 04 01:39 PM
Custom faces for custom menus/commandbars Stu Valentine Excel Programming 1 September 17th 04 04:28 AM
Question on custom commandbars Mark Reynolds Excel Programming 3 January 23rd 04 11:55 PM


All times are GMT +1. The time now is 06:03 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"