Sharon
asked on
find find asterisks in a string
I am pulling the body of out of an Outlook message. There are two rows of asterisks and I need to pull the text between the two rows.
There are various lines of text above the asterisks. The text between the asterisks will have various lines too. Thanks so much!
'**********************
Reason for denial:
'**********************
There are various lines of text above the asterisks. The text between the asterisks will have various lines too. Thanks so much!
'**********************
Reason for denial:
'**********************
Will there be asterisks anywhere else in the message text?
Will there always be the same number of asterisks?
Is this the only text in the body?
You might be able to use the Split() function to parse the text on the vbcrlf character
myText = Split(strBody, vbcrlf)
Then loop through the myText array looking for the asterisks, then concatenate the array elements between the "'***********" strings, or you could use the Replace function, something like:
myText = Replace(strBody, "*", "")
Is this the only text in the body?
You might be able to use the Split() function to parse the text on the vbcrlf character
myText = Split(strBody, vbcrlf)
Then loop through the myText array looking for the asterisks, then concatenate the array elements between the "'***********" strings, or you could use the Replace function, something like:
myText = Replace(strBody, "*", "")
ASKER
I could look for the word "denial:" and then I would need to pull the text until it gets to second line of astrisks. Yes, the two lines of asterisks will be the only ones in the emai.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That is totally awesome! Very elegant! Works like a charm. Thanks!!
glad I could help.