add-new-line

 

Add A New Line To Existing Text Box Text


Add A New Line To Existing Text Box Text

Add new text line to multiline text box through code.


Preparations

Add 1 Command Button to your form (named Command1)


Form Code

Private Sub Command1_Click()
Dim NewText As String
With Text1
'replace 'My New Text' with the Text you want to add
NewText = "My New Text"
.SelStart = Len(.Text)
.SelText = vbNewLine & NewText
End With
End Sub


Private Sub Form_Load()
Text1.Text = "My Initial Text"
End Sub