How to create tooltip in Command Button!!

ahmed_one

New Member
Joined
Jun 27, 2005
Messages
30
Hi,

I've create a button in VBA/Excel, what i need is to create custom tooltip which display brief description about the button when mouse is hover on it.

Please reply soon.

Thanx

Ahmed
 

Some videos you may like

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Zack Barresse

MrExcel MVP
Joined
Dec 9, 2003
Messages
10,881
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Hello Ahmed, welcome to the board!!

You can use something like this ..


<font face=Courier New><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN>

<SPAN style="color:#00007F">Sub</SPAN> Create_Tooltip()
    <SPAN style="color:#00007F">Dim</SPAN> CBB <SPAN style="color:#00007F">As</SPAN> CommandBarButton
    <SPAN style="color:#00007F">Set</SPAN> CBB = Application.CommandBars("Custom 1").Controls("Custom Button")
    CBB.TooltipText = "VOILA!"
    <SPAN style="color:#00007F">Set</SPAN> CBB = <SPAN style="color:#00007F">Nothing</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>

<SPAN style="color:#00007F">Sub</SPAN> Delete_Tooltop()
    <SPAN style="color:#00007F">Dim</SPAN> CBB <SPAN style="color:#00007F">As</SPAN> CommandBarButton
    <SPAN style="color:#00007F">Set</SPAN> CBB = Application.CommandBars("Custom 1").Controls("Custom Button")
    CBB.TooltipText = ""
    <SPAN style="color:#00007F">Set</SPAN> CBB = <SPAN style="color:#00007F">Nothing</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>


The first routine puts a tooltip text on the specified button, the second routine takes it off. You must define the command bar name and the button/control name.
 

Watch MrExcel Video

Forum statistics

Threads
1,118,521
Messages
5,572,623
Members
412,475
Latest member
JaredNAU
Top