Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Lost new custom toolbar button with its macro | Excel Discussion (Misc queries) | |||
Put Wingdings Characters in Toolbar button caption- IF POSSIBLE | Excel Discussion (Misc queries) | |||
custom button to convert into euro on toolbar | Excel Discussion (Misc queries) | |||
Custom toolbar button icons | Excel Discussion (Misc queries) | |||
custom toolbar button that visually toggles in and out | Excel Programming |