English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have to add a custom toolbar that should contain label and button in Excel 2000. I am not able to use msoControlLable and msoControlButton properly. If i m using msoControlButton then caption (text) does not display on runtime. Can somebody help me?


Dim cbBar As CommandBar, cbCtrl1 As CommandBarControl, cbCtrl2 As CommandBarControl
Call DeleteTMCToolbar

Set cbBar = CommandBars.Add(Name:=cCommandBarID, Position:=msoBarTop)


Set cbCtrl1 = cbBar.Controls.Add(Type:=msoControlButton)
With cbCtrl1 '
.BeginGroup = False
.DescriptionText = "Gen"
.DescriptionText = 0
.FaceId = 0
.Caption = "DFA555SDA"
.TooltipText = "General"



'.Name = "Padam"
' .Caption = "TMC"
' .DescriptionText = "Dfasdfas"'
End With


Set cbCtrl2 = cbBar.Controls.Add(Type:=msoControlEdit)
With cbCtrl2
.Caption = "TMC1"
.DescriptionText = "Dfasdfas" '
End With

2006-08-02 18:35:16 · 1 answers · asked by padam_india 1 in Computers & Internet Programming & Design

First of all thanks for your great help. It is working fine.

Now i want to have only Text in custom toolbar. How can i achieve it?

If i am using msoCustomButton with caption only then click event is enable. I do not want that click event.

My requirement is simple text like 'Get Company Report' and it should not be clickable. Can you help me.

2006-08-02 21:04:20 · update #1

1 answers

' -------------------------------------
Dim cbBar As CommandBar
Set cbBar = CommandBars("Test")

Dim cbBtnNew As CommandBarButton

Set cbBtnNew = cbBar.Controls.Add(msoControlButton)
With cbBtnNew
.FaceId = 5
.Caption = "Test Button"
.Style = msoButtonIconAndCaption
End With
' -------------------------------------

Besides the Style property, your problem may have been that you didn't choose a valid FaceId. See the link below for a tool to enumerate them for you.

Hope that helps.

2006-08-02 18:58:31 · answer #1 · answered by Hulett H 2 · 1 0

fedest.com, questions and answers