Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 235
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 235
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Automation - loading text files varsha kashyap Excel Programming 0 October 18th 04 10:13 AM
Count rows in text file by loading into array L Mehl Excel Programming 5 September 11th 04 07:15 AM
Loading Bar rebel1970[_3_] Excel Programming 1 June 22nd 04 10:21 AM
Controlling Text Loading Nigel[_8_] Excel Programming 13 February 13th 04 09:01 AM
Loading text file Clayton L. Wilson Excel Programming 3 July 22nd 03 03:28 PM


All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"