Searching text and numeric from table in outlook messages

G

Guest

I want use pattern matching to find numeric values from Microsoft outlook
message. The search is for words like "Advancers" and followed by finding
numeric values (Separated by space) from next column of the same table of a
HTML message.
The table values are as per below.

Advancers 2016 1811

I do a search to "Advancers" by using a Macro similar to one below.

A = 1
TempB = 0
Do Until TempB Like "*# "
X2 = InStr (1000, Item.Body,"Advancers", 0)
TempB = Mid (Item.Body, X2 + e, A)
A = A + 1
Loop
Where e=10

The purpose of the Macro is to find the first occurrence of numeric (2016)
after finding "Advancers". The problem is that, 2nd numeric value(1811) is
separated by a "space" from 1st one and the search finds the value as
one(20161811). The "TempB" code finds the "space" as a square symbol and the
Val function of "space" says as '0'.
Any suggestions to find the first numeric value only?
 
K

Ken Slovak - [MVP - Outlook]

The "square" symbol means whatever you are getting isn't a space there. It
could be a tab or newline or carriage return or linefeed. I'd bet against a
newline since that would show 2 squares, one for carriage return and the
other for linefeed.

I'd check using the Asc function in debug mode to see what it is exactly
that you're getting back.
 
G

Guest

excellent.I found out.Thank you.

Ken Slovak - said:
The "square" symbol means whatever you are getting isn't a space there. It
could be a tab or newline or carriage return or linefeed. I'd bet against a
newline since that would show 2 squares, one for carriage return and the
other for linefeed.

I'd check using the Asc function in debug mode to see what it is exactly
that you're getting back.
 

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