Adding ToolTips to buttons

C

Carlos Lozano

Hi,

I created an application that adds a new toolbar containing popup menus and
buttons. The popup menus contain commandbuttons (msoControlButton).

I did the following to enable viewing tooltips:
1) assigned text to the tooltiptext of all controls
2) set oCommandBars.DisplayTooltips = True before the buttons are added to
the container controls.

The tooltips are shown for all controls contained in the toolbar (popups and
buttons) but not for the buttons contained in the popups.

I will appreciate any suggestion.

Part of the code is below.

Thank you,

Carlos Lozano

Sub Createmenu
' Objects definitions here
Dim oToolBar As CommandBar
Dim oCommandBars As CommandBars
Dim oButton As CommandBarButton
Dim oPopUp As CommandBarPopup

Set oCommandBars = Application.CommandBars

oCommandBars("SWACO_DesignTool").Delete
oCommandBars.DisplayTooltips = True

On Error GoTo 0
Set oToolBar = oCommandBars.Add("SWACO_DesignTool", msoBarTypeMenuBar)

With Application.ActiveWindow
oToolBar.Left = .Left + .Width - oToolBar.Width
End With

Set oButton = oToolBar.Controls.Add(Office.msoControlButton)
With oButton
.Style = msoButtonCaption
.Caption = "MI SWACO ToolBar"
.OnAction = "About"
End With
' Create Popup and buttons for dialogs
Set oPopUp = oToolBar.Controls.Add(Office.msoControlPopup)
oPopUp.BeginGroup = True
oPopUp.Caption = " Utilities"
oPopUp.Width = Len(oPopUp.Caption)
oPopUp.TooltipText = "Utilities menu."

Set oButton = oPopUp.Controls.Add(Office.msoControlButton)
With oButton
.BeginGroup = True
.Style = msoButtonCaption
.Caption = "Create New Project"
.OnAction = "NewProject"
.TooltipText = "This is the tooltip description text"
End With

Set oButton = oPopUp.Controls.Add(Office.msoControlButton)
With oButton
.Style = msoButtonCaption
.Caption = "'Save As' Project File"
.OnAction = "ExportDesign"
.TooltipText = "This is another tooltip description text"
End With
oToolBar.Visible = True
end sub
 
R

Rob Bovey

Carlos Lozano said:
I created an application that adds a new toolbar containing popup menus
and
buttons. The popup menus contain commandbuttons (msoControlButton).

I did the following to enable viewing tooltips:
1) assigned text to the tooltiptext of all controls
2) set oCommandBars.DisplayTooltips = True before the buttons are added to
the container controls.

The tooltips are shown for all controls contained in the toolbar (popups
and
buttons) but not for the buttons contained in the popups.

Hi Carlos,

Unfortunately, this is just the way command bar controls are designed.
Controls of type msoControlPopup don't display tooltips even if they have
tooltips assigned to them.

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

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top