Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Cannot Get Caption to show on custom toolbar button

Hi Andrea,

For each button you're creating, add the following line of code:

.Type = msoButtonCaption

This will display the caption. If you want to display an icon and the
caption set the Type property to msoButtonIconAndCaption.

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Andrea" wrote in message
...

Hi All,
I have a workbook_open event that contains the following
code. (I am running Excel 2000.)
The toolbar gets created fine but the first two buttons
come up with apparently empty captions (e.g. you can see
the group line and can press the button to trigger the
action but you cannot see the caption to know what button
you are pressing).

I have worked a lot with toolbars in Excel '97 but 2000
is new to me.

What am I doing wrong?

Thanks in advance,
Andrea
-----------------------------
Dim TBar As CommandBar
Dim NewCB As CommandBarControl

' Delete existing toolbar if it exists
For Each cb In CommandBars
If cb.Name = "MLPS" Then
cb.Delete
Exit For
End If
Next

' Create a new toolbar
Set TBar = CommandBars.Add
With TBar
.Name = "MLPS"
.Position = msoBarBottom
.Left = 150
.Visible = True
End With
Set NewCB = TBar.Controls.Add(Type:=msoControlButton)
'CommandBars("MLPS").Controls.Add
(Type:=msoControlButton)
With NewCB
.Caption = "ABC"
.Visible = True
.OnAction = "DataEntryView"
.TooltipText = "View data in data entry view"
.Enabled = True

End With
Set NewCB = TBar.Controls.Add(Type:=msoControlButton)
'CommandBars("MLPS").Controls.Add
(Type:=msoControlButton)
With NewCB
.Caption = "Clear"
.Visible = True
.OnAction = "CleartheScreen"
.TooltipText = "View data in data entry view"
.BeginGroup = True
End With

Set PopUp = CommandBars("MLPS").Controls.Add
(Type:=msoControlPopup)
With PopUp
.Caption = "Table Views"
.TooltipText = "View data in table formats"
.BeginGroup = True
' Add a control button control
Set NewCB = .Controls.Add(Type:=msoControlButton)
With NewCB
.BeginGroup = True
.Caption = "Matter/Property Data"
.Visible = True
.OnAction = "UnHideMatterData"
.FaceId = 40 'down arrow
.TooltipText = "View data in table format"
.Style = msoButtonIconAndCaption
End With

Set NewCB = .Controls.Add(Type:=msoControlButton)
With NewCB
.BeginGroup = True
.Caption = "Borrower Data"
.Visible = True
.OnAction = "UnHideBorrowerData"
.FaceId = 40 'down arrow
.TooltipText = "View data in table format"
.Style = msoButtonIconAndCaption
End With
Set NewCB = .Controls.Add(Type:=msoControlButton)
With NewCB
.BeginGroup = True
.Caption = "Seller Data"
.Visible = True
.OnAction = "UnHideSellerData"
.FaceId = 40 'down arrow
.TooltipText = "View data in table format"
.Style = msoButtonIconAndCaption
End With
End With


End Sub



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Cannot Get Caption to show on custom toolbar button

Thank you. That was one of those "What was I thinking?" ones. (or more
aptly put..."What was I not thinking?")

"Rob Bovey" wrote in message ...
"Rob Bovey" wrote in message
...
Hi Andrea,

For each button you're creating, add the following line of code:

.Type = msoButtonCaption

This will display the caption. If you want to display an icon and the
caption set the Type property to msoButtonIconAndCaption.


Sorry about that Type nonsense, what I meant to say was set the *Style*
property, i.e.

.Style = msoButtonCaption

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
Lost new custom toolbar button with its macro hmm Excel Discussion (Misc queries) 6 July 4th 07 12:26 AM
Put Wingdings Characters in Toolbar button caption- IF POSSIBLE chris Excel Discussion (Misc queries) 0 July 6th 06 08:18 PM
custom button to convert into euro on toolbar jigio Excel Discussion (Misc queries) 3 September 5th 05 09:03 PM
Custom toolbar button icons leaftye - ExcelForums.com Excel Discussion (Misc queries) 2 July 7th 05 06:09 PM
custom toolbar button that visually toggles in and out Paul Simon[_2_] Excel Programming 1 July 26th 03 10:35 PM


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