Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Sub menu with FaceIDs only in a CommandBar

I have my own CommandBar wich is composed of different FaceIDs. By clicking
on the FaceID, it starts my own procedure.

How could I create a sub menu with buttons only. The buttons would be
FaceIDs.
I would like that it works like the "Borders" icon in the Excel "Formatting"
CommandBar.

Here is what I tried without success.

Sub SetMyCmdBar()
Dim CmdBar

Dim Btn As CommandBarButton
Dim Fld As CommandBarControl

Dim BtnPopup As CommandBarControl
Dim BtnItem As CommandBarControl

Dim ArrCaption As Variant
Dim ArrFaceID As Variant
Dim ArrOnAction As Variant
Dim ArrToolTipText As Variant
Dim i As Integer

Application.ScreenUpdating = False

On Error Resume Next
Application.CommandBars("MyCommandBar").Delete
On Error GoTo 0

Set CmdBar = Application.CommandBars.Add
With CmdBar
.Name = "MyCommandBar"
.Visible = True
.Position = msoBarTop

'I have several buttons like the following
Set Btn = .Controls.Add 'MailThisFile
With Btn
.Style = msoButtonIconAndCaption
.FaceId = 258
.Width = 20
.OnAction = "MailThisFile"
.TooltipText = "Mail this file (Lotus Notes)"
.BeginGroup = True
.Tag = "MyBtn"
End With


ArrCaption = Array("Top", "Middle", "Bottom")
ArrFaceID = Array(2061, 2062, 2063)
ArrOnAction = Array("TopVertical", "MiddleVertical", "BottomVertical")
ArrToolTipText = Array("Align Selection on Top", "Align Selection on
Middle", "Align Selection on Bottom")

Set BtnPopup = .Controls.Add(Type:=msoControlPopup)
With BtnPopup
'.Caption = "Vertical Alignment"
.FaceId = 2068
.Tag = "MyBtn"

For i = 0 To 2
Set BtnItem = .Controls.Add
With BtnItem
'.Caption = ArrCaption(i)
.Style = msoButtonIconAndCaption
.FaceId = ArrFaceID(i)
.Width = 20
.OnAction = ArrOnAction(i)
.TooltipText = ArrToolTipText(i)
.Tag = "MyBtn"
End With
Next i

End With 'BtnPopup

End With 'CmdBar


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
How to pimp my custom menu (want to display FaceIds and shortcuts combo)? s80NL[_6_] Excel Programming 5 July 16th 06 12:48 AM
popup menu commandbar Edward Excel Programming 2 July 14th 06 07:05 PM
Password on Commandbar menu list JB2005 Excel Programming 2 August 24th 05 08:10 AM


All times are GMT +1. The time now is 06:59 PM.

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"