Combo Box (ControlTipText)

adambc

Board Regular
Joined
Jan 13, 2020
Messages
133
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
ControlTipText appears when the User hovers over the Combo Box ...

Is there anyway of displaying this text in grey in the Combo Box?

Similar to the way in which many online forms do.

Thanks ...
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,872
Office Version
  1. 365
Platform
  1. Windows
Is the combobox in a userform? Consider this option
Insert a label above the combobox (Label1)
Paste controltip text into Label1 and amend Label1 properties to render the text grey
Make Label1 non-visible until user hovers over the combobox
Leave Label1 visible whilst the mouse is over the combobox

Example code
VBA Code:
Private Sub UserForm_Initialize()
    ShowLabel False
End Sub
Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    ShowLabel False
End Sub
Private Sub ComboBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
    ShowLabel True
End Sub
Private Sub ShowLabel(X As Boolean)
    Label1.Visible = X
End Sub
 

adambc

Board Regular
Joined
Jan 13, 2020
Messages
133
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Thanks, but that doesn’t give me much/any more than simply adding the text to the ControlTipText Combo Box property ...

What I was hoping for is for the text to be visible in the Combo Box When the UserForm loads ...

My text is “Select From List or Enter Manual Value” (or words to that effect (the Combo Box property is set to allow a manual entry) ...

Any more ideas anyone?

Thanks ...
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,872
Office Version
  1. 365
Platform
  1. Windows
What I was hoping for is for the text to be visible in the Combo Box When the UserForm loads ...
in which case ....
VBA Code:
Private Sub UserForm_Initialize()
    ShowLabel True
End Sub
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,872
Office Version
  1. 365
Platform
  1. Windows
Another idea

VBA Code:
Private Sub UserForm_Initialize()
    ComboBox1.Value = ComboBox1.ControlTipText
End Sub

Private Sub ComboBox1_DropButtonClick()
    ComboBox1.Value = ""
End Sub
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,872
Office Version
  1. 365
Platform
  1. Windows
Or you could use a label and place it above the combo box so that the text appears to be inside the box
(format it as preferred)

The text disappears when anything is selected or entered manually

VBA Code:
Private Sub UserForm_Initialize()
    Label1.Caption = ComboBox1.ControlTipText
End Sub
Private Sub ComboBox1_Change()
    Label1.Visible = False
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,118,359
Messages
5,571,718
Members
412,414
Latest member
KasunC
Top