Hi,
I'm creating a user form textbox to display a large message because msgbox has character limitation.
I created a user form, added a text box and changed the follwoing properties:
MultiLine = True
ScrollBars = 2 - fmScrollBarsVertical
Width = 600
WordWrap = True.
In the vba code of this form I have the following:
I have another sub which passes text to global variable txt and at the end shows the form.Code:Private Sub TextBox1_Change() TextBox1.Text = txt End Sub
The problem is: The form shows up with the text box, but no text in it. When I click inside and type any key. The text shows up. Why does this happen? and how do i make the text show up right away on load?Code:Global txt As String Sub text() txt = Sheets("Sheet4").Cells(i, "B").Text & vbNewLine & _ Sheets("Sheet4").Cells(i, "C").Text & vbNewLine & _ Sheets("Sheet4").Cells(i, "D").Text & vbNewLine & _ Sheets("Sheet4").Cells(i, "E").Text & vbNewLine & _ Sheets("Sheet4").Cells(i, "F").Text & vbNewLine & _ Sheets("Sheet4").Cells(i, "H").Text & vbNewLine & vbNewLine UserForm1.Show End Sub
Thanks




Reply With Quote