![]() |
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 |
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 |
All times are GMT +1. The time now is 11:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com