PDA

View Full Version : Solved: Wrapping text in a ControlTipText



nst1107
12-18-2008, 06:32 PM
Is there a way to wrap text in the ControlTipText of a userform control? I've tried setting the property in runtime and using Chr(10), but that doesn't work.

Kenneth Hobs
12-19-2008, 06:38 AM
ControlTip property does not allow multilines.

Instead, use the MouseMove event for the control and userform. In this example, I set it for both TextBox2 and Label1. If you use the TextBox to hold text for a status kind of thing, set Locked=True and MultiLine=True.
Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
TextBox2.Value = "Hello," & vbLf & Environ("username")
Label1.Caption = TextBox2.Value
End Sub


Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
TextBox2.Value = vbNullString
Label1.Caption = vbNullString
End Sub

nst1107
12-19-2008, 03:06 PM
That's too bad about no multilines. Makes things all that more complicated. Thanks for the suggestion, though. Looks like that's what I'm going to have to do.