getting a string in between two crlf

S

Steven Scaife

How do i get part of a string out of some text from the 3crlf to the 4th
crlf.

using mid I have found that the text i want starts at the 70th character.
The end character will be different on each iteration of the loop.

Basically i am looping through the contents of an email folder which i can
do, and reading the body but i only need a certain part of the email. I can
then split the line on the delimiter ; which i know how to do, i'm just not
sure how to work out the length i need on each loop. If i can work that out
I can then use mid to take the string i need.

So how do i move through the text till i reach the 4th crlf, do i use instr
and count a variable and stop once it reaches 4?

tia
 
J

JackD

Steven Scaife said:
How do i get part of a string out of some text from the 3crlf to the 4th
crlf.

using mid I have found that the text i want starts at the 70th character.
The end character will be different on each iteration of the loop.

Basically i am looping through the contents of an email folder which i can
do, and reading the body but i only need a certain part of the email. I can
then split the line on the delimiter ; which i know how to do, i'm just not
sure how to work out the length i need on each loop. If i can work that out
I can then use mid to take the string i need.

So how do i move through the text till i reach the 4th crlf, do i use instr
and count a variable and stop once it reaches 4?

tia


This group is for Microsoft Project VBA, so you might want to ask the
question in an outlook group or something similar. There may be special
methods for reading the body or stripping the header.

I'd just use find, len and right four times

dim forthLineStart, forthLineEnd as integer
forthLineStart = find(";",Right(mystring,len(mystring -Find(...'nest this a
couple more times)
forthLineEnd = 'same thing but one more iteration - if there is no final ;
then forthLineEnd is len(mystring)
But then I'm hardly an expert on working with strings.

-Jack
 

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

Top