Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ControlTipText on a Worksheet Button - How? 1

Status
Not open for further replies.

origapizni

Programmer
Aug 2, 2001
29
0
0
US
Is there a way to add a Tip Text to a Command Button on an Excel Worksheet (NOT on a button bar and NOT on a form - the button is directly on the worksheet)?

Command buttons don't appear to have the ControlTipText property when used this way.

Using Excel 2k, Office2k, Win2k
 
No - control toolbox objects have neither a controltiptext property nor a mouseover event, so I don't think you can achieve what you're attempting. But I've been proven wrong (many times) before :)
Rob
[flowerface]
 
Actually, there is a MouseMove event that you can trap when the mouse is moving over the button, but you still have a steep climb ahead of you.

Since there isn't a MouseMove event for the underlying sheet, you should first put down an image (a picture is not necessary) and then put the button on top of the image. Finally, put a text box with your tip on top of the whole mess, leaving a bit of the image showing all around the button.

Set the design-time visibility for the text box to false. Then when the MouseMove fires for the button, you can show the text and when MouseMove fires for the image you can hide it:
Code:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  If TextBox1.Visible = False Then TextBox1.Visible = True
End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
  If TextBox1.Visible = True Then TextBox1.Visible = False
End Sub
 
I was about to suggest the mousemove event as well, but Zathras beat me to it. HOwever I would suggest against a textbox, that will halt the workbook since the messagebox can't change the modal settings. My suggestion would be CHANGE the CAPTION of the button? Otherwise lengthy expressions could be used by message box or more creatively w/ the userform that you could dynamically change the caption and after a few seconds, autohide the userform again? Just a few suggestions. [yinyang] Tranpkp [pc2]
 
Another method would be to build a custom icon for the button. This would be a painful approach if you had a lot of buttons requiring different tips. It also has the disadvantage of being in the user's face every time they use the button and is limited in size and content but allows some creativity in design.

...Ron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top