Press
09-01-2013, 04:37 AM
Hi
Create a Multiline TextBox in Userform
It is possible to insert a row in the text reposition the cursor in the text
I'm using the following code:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
Pos = TextBox1.SelStart
TextBox1.Text = Left(TextBox1.Text, TextBox1.SelStart) & Chr(10) & Mid(TextBox1.Text, TextBox1.SelStart, Len(TextBox1) - TextBox1.SelStart + 1)
TextBox1.SelStart = Pos
End If
End Sub
Thanks in advance
Create a Multiline TextBox in Userform
It is possible to insert a row in the text reposition the cursor in the text
I'm using the following code:
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 13 Then
Pos = TextBox1.SelStart
TextBox1.Text = Left(TextBox1.Text, TextBox1.SelStart) & Chr(10) & Mid(TextBox1.Text, TextBox1.SelStart, Len(TextBox1) - TextBox1.SelStart + 1)
TextBox1.SelStart = Pos
End If
End Sub
Thanks in advance