Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a Text Box
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a Text Box
Setting MultiLine property of textbox to TRUE and using vbCRLF worked for me.
"John Mansfield" wrote: 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a Text Box
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) "John Mansfield" wrote in message ... 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Loading a Text Box
Thanks Bob and Toppers. I totally missed the Multiline property.
John Mansfield "Bob Phillips" wrote: 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) "John Mansfield" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Automation - loading text files | Excel Programming | |||
Count rows in text file by loading into array | Excel Programming | |||
Loading Bar | Excel Programming | |||
Controlling Text Loading | Excel Programming | |||
Loading text file | Excel Programming |