Simple code to look for a specific line

Frankmil

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi Diane!
I tried to look for this simple code in your forum but I didn't find it.
I always receive mail with label and without label(thank to you,I know how to extract data with label ones) , I just want to extract the line before the last one . For exemple , my mail is:
Xxxx
Thank you very much
Jone smith
Industry corp and cie

What is the vba outlook 2010 to use for looking (and copy) the one before last line (here it's jone smith).
Thank you for your help
Frank
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I don't know if you could count lines and get the next to last one, but unless a line containing 'thank' always leads the line you want, its going to be tough to do. (I assume the last line will vary.) Actually, if you can count lines, you would also need to test for content, because blank lines at the end would throw it off.

If the preceding line will always have thank in some form, try something like "thank(.*)\n(.*)\n" and pick up the second (.*)
 

Frankmil

Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Hi Diane
Yes, the preceding line will always have thanks line.
But how I pick up the second (.*)?
Regards
 
Top