P
papagru
How do I create a hovering tooltip for a macro button; Word 2002
koolnuts said:How are you creating the button on the toolbar / CommandBar?
There are at least two ways to do this:
1. is through code, which then allows you to change the tooltiptext
property, eg.
Sub MyCreateCommandBar
Dim cbar As CommandBar
Set cbar = CommandBars.Add(Name:="CommandBarName", Position:=msoBarTop,
Temporary:=False)
With CommandBars.Item("CommandBarName").Controls
' Add cmdToggleBold button
.Add Type:=msoControlButton, ID:=1
.Item(1).Caption = "Toggle Bold"
.Item(1).DescriptionText = "Toggle Bold"
.Item(1).TooltipText = "some text some text some text some text"
.Item(1).FaceId = 113
.Item(1).OnAction = "cmdToggleBold"
.Item(1).Enabled = True
End With
cbar.Visible = True
cbar.Enabled = True
set cbar = nothing
End Sub
You would then call MyCreateCommandBar from an AutoExec or AutoOpen or
AutoNew macro which ever is appropriate.
2. is by customising a commandbar in Word, eg.
Tools->Customise->Commands->Macros->select a macro name and drag it to the
CommandBar. Unfortunately this does not allow you to change the TooltipText
property other than by using code.
CommandBars("CommandBarName").Controls("ControlName").TooltipText = "Click
for help on ..."
which you would then also put into a AutoExec or AutoOpen or AutoNew macro
so it would setup the button as soon as the document is opened, executed
(AutoExec for loading global templates / documents) or created (AutoNew).
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.