Create - Help popup in userform

Starbucks_33

Active Member
Joined
Jun 16, 2008
Messages
345
Hi,

In some of the applications I have used on the form, when you move the mouse pointer over an icon, a little window will pop up and tell you information about the icon. Like for example if you are in excel and you put the cursor on the "paste" icon a window pops up that says "format painter".

Is it possible to add this to an icon on my excel userform?

Thanks for your help.

Excel 2003, Windows XP.
 

Some videos you may like

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

MorganO

Active Member
Joined
Nov 21, 2006
Messages
483
Here is a method that is not quite as slick as the floating info popups you see on icons, but it works. It uses modeless userforms (I think that is the right term when you make showmodal in the properties of the form = False) to display the pop up.

For my example below you will need to create 2 userforms. In both userforms in the properties make 'ShowModal = False'. In userform1 add 2 command buttons: commandbutton1 and commandbutton2.

Insert this code into userform1:

Code:
Private Sub CommandButton1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If UserForm2.Visible = False Then
Formtop = UserForm1.Top 
Formleft = UserForm1.Left
ButtonHeight = CommandButton1.Height
ButtonWidth = CommandButton1.Width
ButtonTop = CommandButton1.Top
ButtonLeft = CommandButton1.Left
Call ShowPopUp("CommandButton1 Info", Formtop + ButtonHeight + ButtonTop, Formleft + ButtonWidth + ButtonLeft)
End If
End Sub
Private Sub CommandButton2_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
If UserForm2.Visible = False Then
Formtop = UserForm1.Top 
Formleft = UserForm1.Left 
ButtonHeight = CommandButton2.Height
ButtonWidth = CommandButton2.Width
ButtonTop = CommandButton2.Top
ButtonLeft = CommandButton2.Left
Call ShowPopUp("CommandButton2 Info", Formtop + ButtonHeight + ButtonTop, Formleft + ButtonWidth + ButtonLeft)
End If
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
UserForm2.Hide
End Sub
Sub ShowPopUp(PopUpDialog As String, X_value As Double, Y_value As Double)
UserForm2.Show
UserForm2.TextBox1.Value = PopUpDialog
UserForm2.Top = X_value
UserForm2.Left = Y_value
End Sub

Whenever you move the mouse over a commandbutton, userform2 will display to the right of the commandbutton with your userdefined message.

Hope this points you in the right direction.

Owen
 

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Hi , Google "VBA + tooltip Text."
for bits like:-
Code:
Private Sub UserForm_Activate()
     CommandButton1.ControlTipText = "click to activate"
End Sub
Regards Mick
 

MorganO

Active Member
Joined
Nov 21, 2006
Messages
483
Private Sub UserForm_Activate()
CommandButton1.ControlTipText = "click to activate"
End Sub

Very interesting! I didn't realize what that was before! Thanks for the info.

Take care.

Owen
 

Starbucks_33

Active Member
Joined
Jun 16, 2008
Messages
345

ADVERTISEMENT

That is very helpful thank you!
 

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,023
Is there a way to have a text message display when just MOVING over the a CommandButton created via a Control ToolBox. There is no UserForm
 

MickG

MrExcel MVP
Joined
Jan 9, 2008
Messages
14,841
Hi, I don't think so , probably the best you can do is, assign you Code to a Shape or Picture, then right click the shape, Select Hyperlink, click "Place in this Document", click "Screentip", Enter you Mouse over Text, click OK.
You should now have a mouseover on the shape.
You could also assign the Hyperlink to a cell and place the Command Button on the cell, But it would have to be smaller than the cell to register the Mouseover.
Regards Mick
 

Watch MrExcel Video

Forum statistics

Threads
1,122,569
Messages
5,596,915
Members
414,110
Latest member
docops

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top