Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Formatting text in a textbox to show separate lines

Hello --

I want to populate a textbox so user can copy any or all of its information
to another field.

Contents of the text box are built up by parsing a text string and repeating
in a loop:

strComment = strComment & _
vbCrLf & _
Trim(strTempText)

where strTempText is the parsed/loop value

The desired result looks like separate lines:

Start time: 1059167091
End time: 1059167104
Proto: TCP
Source IP: 216.218.241.95
Source name: abc.com
src port: 20
Dest IP: 102.999.50.12
Dest name: eleuthera
Dest port: 1060
Connection number: 1
Total packets: 641
Total payload: 931760

I am able to get this format when I display a message box containing the
final value of strComment.

However, when I put the final value of strComment in a textbox, it appears
as one long string.

Can someone help me build strComment so that it appears in a textbox looking
like separate lines?

Thanks for any help.

Larry Mehl



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formatting text in a textbox to show separate lines

What type of textbox - from the drawing toolbar (on a worksheet) or from the
control toolbox toolbar (on a worksheet or on a userform)?

--
Regards,
Tom Ogilvy

"L Mehl" wrote in message
...
Hello --

I want to populate a textbox so user can copy any or all of its

information
to another field.

Contents of the text box are built up by parsing a text string and

repeating
in a loop:

strComment = strComment & _
vbCrLf & _
Trim(strTempText)

where strTempText is the parsed/loop value

The desired result looks like separate lines:

Start time: 1059167091
End time: 1059167104
Proto: TCP
Source IP: 216.218.241.95
Source name: abc.com
src port: 20
Dest IP: 102.999.50.12
Dest name: eleuthera
Dest port: 1060
Connection number: 1
Total packets: 641
Total payload: 931760

I am able to get this format when I display a message box containing the
final value of strComment.

However, when I put the final value of strComment in a textbox, it appears
as one long string.

Can someone help me build strComment so that it appears in a textbox

looking
like separate lines?

Thanks for any help.

Larry Mehl



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Formatting text in a textbox to show separate lines

Hi Tom --

Sorry for the vague description.

This is a textbox on a userform.

Larry


"Tom Ogilvy" wrote in message
...
What type of textbox - from the drawing toolbar (on a worksheet) or from

the
control toolbox toolbar (on a worksheet or on a userform)?

--
Regards,
Tom Ogilvy

"L Mehl" wrote in message
...
Hello --

I want to populate a textbox so user can copy any or all of its

information
to another field.

Contents of the text box are built up by parsing a text string and

repeating
in a loop:

strComment = strComment & _
vbCrLf & _
Trim(strTempText)

where strTempText is the parsed/loop value

The desired result looks like separate lines:

Start time: 1059167091
End time: 1059167104
Proto: TCP
Source IP: 216.218.241.95
Source name: abc.com
src port: 20
Dest IP: 102.999.50.12
Dest name: eleuthera
Dest port: 1060
Connection number: 1
Total packets: 641
Total payload: 931760

I am able to get this format when I display a message box containing

the
final value of strComment.

However, when I put the final value of strComment in a textbox, it

appears
as one long string.

Can someone help me build strComment so that it appears in a textbox

looking
like separate lines?

Thanks for any help.

Larry Mehl



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formatting text in a textbox to show separate lines

This worked for me as an example. Make sure your textbox is wide enough:

Public sStr As String

Sub Showform()
sStr = _
"Start time: 1059167091" & vbCrLf & _
"End time: 1059167104" & vbCrLf & _
"Proto: TCP" & vbCrLf & _
"Source IP: 216.218.241.95" & vbCrLf & _
"Source Name: abc.com" & vbCrLf & _
"src port: 20" & vbCrLf & _
"Dest IP: 102.999.50.12" & vbCrLf & _
"Dest Name: eleuthera" & vbCrLf & _
"Dest port: 1060" & vbCrLf & _
"Connection number: 1" & vbCrLf & _
"Total packets: 641" & vbCrLf & _
"Total payload: 931760"
With UserForm1
' .TextBox1.WordWrap = True
.TextBox1.MultiLine = True
.TextBox1.Text = sStr
.Show
End With
End Sub


--
Regards,
Tom Ogilvy

"L Mehl" wrote in message
...
Hi Tom --

Sorry for the vague description.

This is a textbox on a userform.

Larry


"Tom Ogilvy" wrote in message
...
What type of textbox - from the drawing toolbar (on a worksheet) or from

the
control toolbox toolbar (on a worksheet or on a userform)?

--
Regards,
Tom Ogilvy

"L Mehl" wrote in message
...
Hello --

I want to populate a textbox so user can copy any or all of its

information
to another field.

Contents of the text box are built up by parsing a text string and

repeating
in a loop:

strComment = strComment & _
vbCrLf & _
Trim(strTempText)

where strTempText is the parsed/loop value

The desired result looks like separate lines:

Start time: 1059167091
End time: 1059167104
Proto: TCP
Source IP: 216.218.241.95
Source name: abc.com
src port: 20
Dest IP: 102.999.50.12
Dest name: eleuthera
Dest port: 1060
Connection number: 1
Total packets: 641
Total payload: 931760

I am able to get this format when I display a message box containing

the
final value of strComment.

However, when I put the final value of strComment in a textbox, it

appears
as one long string.

Can someone help me build strComment so that it appears in a textbox

looking
like separate lines?

Thanks for any help.

Larry Mehl



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Formatting text in a textbox to show separate lines

Tom --

Thank you for helping me.

It worked for me, too. I use it to enable the user to cut and paste from it
when creating the Legend text.

My error was forgetting to set WordWrap and MultiLine = True.

I had gotten a RichTextBox to work, but was not sure if distributing the xls
to others would cause install problems.

Larry

"Tom Ogilvy" wrote in message
...
This worked for me as an example. Make sure your textbox is wide enough:

Public sStr As String

Sub Showform()
sStr = _
"Start time: 1059167091" & vbCrLf & _
"End time: 1059167104" & vbCrLf & _
"Proto: TCP" & vbCrLf & _
"Source IP: 216.218.241.95" & vbCrLf & _
"Source Name: abc.com" & vbCrLf & _
"src port: 20" & vbCrLf & _
"Dest IP: 102.999.50.12" & vbCrLf & _
"Dest Name: eleuthera" & vbCrLf & _
"Dest port: 1060" & vbCrLf & _
"Connection number: 1" & vbCrLf & _
"Total packets: 641" & vbCrLf & _
"Total payload: 931760"
With UserForm1
' .TextBox1.WordWrap = True
.TextBox1.MultiLine = True
.TextBox1.Text = sStr
.Show
End With
End Sub


--
Regards,
Tom Ogilvy

"L Mehl" wrote in message
...
Hi Tom --

Sorry for the vague description.

This is a textbox on a userform.

Larry


"Tom Ogilvy" wrote in message
...
What type of textbox - from the drawing toolbar (on a worksheet) or

from
the
control toolbox toolbar (on a worksheet or on a userform)?

--
Regards,
Tom Ogilvy

"L Mehl" wrote in message
...
Hello --

I want to populate a textbox so user can copy any or all of its
information
to another field.

Contents of the text box are built up by parsing a text string and
repeating
in a loop:

strComment = strComment & _
vbCrLf & _
Trim(strTempText)

where strTempText is the parsed/loop value

The desired result looks like separate lines:

Start time: 1059167091
End time: 1059167104
Proto: TCP
Source IP: 216.218.241.95
Source name: abc.com
src port: 20
Dest IP: 102.999.50.12
Dest name: eleuthera
Dest port: 1060
Connection number: 1
Total packets: 641
Total payload: 931760

I am able to get this format when I display a message box

containing
the
final value of strComment.

However, when I put the final value of strComment in a textbox, it

appears
as one long string.

Can someone help me build strComment so that it appears in a textbox
looking
like separate lines?

Thanks for any help.

Larry Mehl



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.581 / Virus Database: 368 - Release Date: 2/9/2004




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
Looking for code to separate one line of text into multiple lines in Excel [email protected] Excel Worksheet Functions 1 February 13th 07 12:59 AM
How can I get excel to show ALL lines of wrapped text? bmg Excel Worksheet Functions 0 December 27th 05 05:39 PM
How do I merge 3 lines of text to show in one row? pita29 Excel Discussion (Misc queries) 3 August 7th 05 02:36 AM
formatting text in TextBox in UserForm Kevin Excel Programming 2 November 7th 03 01:34 PM
Retaining text formatting in TextBox Tom Ogilvy Excel Programming 0 September 9th 03 08:05 PM


All times are GMT +1. The time now is 02:59 PM.

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

About Us

"It's about Microsoft Excel"