Loading a Text Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a userform that contains one text box. The userform is activated by a
command button on a worksheet. As a simple example, when I hit the button I
want the userform to appear with the names Bill and Kim in the textbox
stacked one over the other i.e.

Bill
Kim

I can't figure out how to ge the line break to work.

I've tried:

Private Sub UserForm_Initialize()
TextBox1.Value = "Frank" & vbLineBreak & "Kim"
End Sub

and

Private Sub UserForm_Initialize()
TextBox1.Value = "Frank" & vbCrLf & "Kim"
End Sub

In the examples above I know a listbox would work. However, in reality I
have a sample of HTML code that is generated via a macro. I want that code
to appear in the text box. How can I get the textbox to allow line breaks?
Thanks for your help.

John
 
Use

TextBox1.Value = "Frank" & vbCrLf & "Kim"

but also change the MultiLine property of the textbox to true

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top