Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

searching a string for a carriage return and line feed

Status
Not open for further replies.

Board2Death

Technical User
Apr 27, 2005
88
US
I have a string that has several CR and LF in it. The string was created using something along the line of:

str = "xxxxxx" & vbcrlf & " yyy" & vbcrlf & "zz"

I would like to know how to find the start of each new line within this string. I thought that the InStr function would be useful, but I can't seem to get it to work.

I am planning on printing the string in a text box, and I want the text to look like:
Code:
New Value: xxxxxx
           yyy
           zz
So I figured I would need to find the beginning of each line to accomplish this. TIA...
 
Doesn't

[tt]debug.print instr(yourstring, vbcrlf)[/tt]

give the result you need (add 1 or two to get next "line")? And doesn't just assigning this string to a text control give you this?

Roy-Vidar
 
GREAT...It does work. I had been trying:

instr(0, str, vbcrlf)

which does not work for some reason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top