-
TextBox Editor
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:
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
-
In the VB Editor (VBE), press F4 to show the Properties editor. Click on the TextBox to show its properties and set the EnterKeyBehavior to True. No code needed.
In the VBE and any of its windows, you can place the cursor in or next to a word and press F1 for help on that item.
Pressing F2 will bring up the Object Browser with can give you deeper information about things. In the OB, pressing F7 will return to the VBE
-
Hi
Thank you for the information, it is perfect.