PDA

View Full Version : [SOLVED:] Multi-line Control Tip Text



HTSCF Fareha
03-16-2021, 03:15 PM
I reckon by a long trawl across G***le that there isn't a way to do this. But I'd thought that I would ask anyhow.

I've tried the following without success.

TextBox4.ControlTipText = "hello" & vbCrLf & "there"
TextBox4.ControlTipText = "hello" & vbCr & "there"
TextBox4.ControlTipText = "hello" & Chr(10) & "there"
TextBox4.ControlTipText = "hello" & Chr(11) & "there"
TextBox4.ControlTipText = "hello" & Chr(13) & "there"

Paul_Hossler
03-18-2021, 09:06 AM
No way to make a control tip multi-line

A workaround might be showing and hiding a label.

This could use some polish

28131




Option Explicit


Private Sub UserForm_Initialize()
With Me
.Label1.Top = .TextBox1.Top + 5
.Label1.Left = .TextBox1.Left + 5
.Label1.Width = .TextBox1.Width - 5
.Label1.Caption = "This is" & vbCrLf & "a test" & vbCrLf & "of a multi-line 'tooltip'"
.Label1.AutoSize = True
End With
End Sub


Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = False
End Sub


Private Sub CommandButton1_Click()
UserForm1.Hide
Unload UserForm1
End Sub


Private Sub TextBox1_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = True
End Sub


Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Me.Label1.Visible = False
End Sub


Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Me.Label1.Visible = False
End Sub


Private Sub Label1_Click()
Me.Label1.Visible = False
End Sub


Private Sub Label1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = False
End Sub

gmayor
03-19-2021, 01:00 AM
Or simpler still, put the instructions on the userform, and/or use a button to display a help text

28137

28136

HTSCF Fareha
03-20-2021, 04:34 AM
Many thanks to you both.

Paul, out of interest I'll look at your suggestion.

However, Graham has I think come up with the most obvious (hence why I missed it) solution.

I really like the button design and am hoping to have something similar on my userform. A bit of testing to come!

Thanks again!

HTSCF Fareha
03-20-2021, 01:30 PM
Looking to have four different buttons to display four different pieces of text.

I was thinking something like this might work?


Private Sub CommandButton1_Click()
If CommandButton1.Value = True Then
Label20.Visible = False
Label20.Text = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
Else
Label20.Visible = True
End If
End Sub
Are showing / hiding labels possible? If they are, what would the default values be on the UserForm?

Is the above code the best way of showing the separate bits of text? I have each of the buttons by their default names at the moment from 1 to 4. I'd also like the user to be able to select pieces of the text when they are revealed too.

Steve

gmaxey
03-21-2021, 02:34 PM
Well, you can select the caption of a label control. You could use a textbox control default visible = false:

Private Sub CommandButton1_Click()
If TextBox1.Visible Then
TextBox1.Visible = False
Else
TextBox1.Visible = True
TextBox1.Text = "Whatever"
End If
End Sub

HTSCF Fareha
03-22-2021, 02:12 PM
Thanks Greg, this works just fine!

Is there a way of making the first word bold within the UserForm TextBox.

I thought that this might do the trick?


Private Sub CommandButton1_Click()
Dim rngDoc As Range
Set rngDoc = ActiveDocument.Range.Words(1)
rngDoc.Bold = True
If TextBox10.Visible Then
TextBox10.Visible = False
Else
TextBox10.Visible = True
TextBox10.Text = "Test - Some other descriptive text to explain further"
End If
End Sub

Of course it might be that this is just not possible?

gmaxey
03-22-2021, 04:08 PM
It is just not possible.

HTSCF Fareha
03-22-2021, 11:33 PM
Thanks, Greg! I thought that was likely to be the answer.

Steve