More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Login

login
password
Remember me

You will need to register and log in if you want to download the source code for the Microsoft Outlook Programming book. The forums and code sharing areas are open to both registered and non-registered visitors.

share code 02-Sep-2010 22:23

Looking for help with Outlook programming projects — VSTO, add-ins, VBA, custom Outlook forms, etc.? You′ve come to the right place!

NEW! >> Subscribe to this site via RSS. For more RSS options, see the complete list of feeds on our main news page.

 

Code level: beginner    Code area: Code Essentials Printer Friendly Version
Title: Extract data from a structured text block
Description: This function extracts the data from any label-data pair that appears in a block of text, where all the label-data pairs are on separate lines. A typical application would be parsing the text sent as email by a form on a web site, where the incoming message has multiple lines each with a different Label: Data pair. For an example of this in use, see the thread at http://www.outlookcode.com/threads.aspx?forumid=2&messageid=696
Date: 09-May-2003  00:42
Code level: beginner
Code area: Code Essentials
Posted by: Sue Mosher
Body:
All 44comments
Page [ 1 2 3 4 5 Next >>  
  06-Dec-2004  23:06   
New here so dont laugh, but now that you have parsed this text what are you doing with it? for this to satisfy my needs it would have to paste the parsed text into excel or notepad, heck even access..

any possiblity of that?

MIke
  07-Dec-2004  14:48   
You do what ever you want to with it, using methods appropriate for the particular application. You can use FileSystemObject methods to create a text file (see http://msdn.microsoft.com/library/en-us/script56/html/fsooriscriptingrun-timereference.asp or ADO methods to connect to a database (see http://www.outlookcode.com/d/database.htm )
  11-Dec-2004  23:18   
Thanks Sue for your reply.. the sight is great and I am learning things. and hoping to work them all together to achieve my result. i have this extremely ugly (and i mean content wise not formatting) messages that arrive at the rate of 42 every hour. each has a different format, number of lines, and content-most of which is stripped away.
the remaining information has to be placed in either excel or access (whichever i get to work first), split into chunks, check against existing data. in the event a fail condition occurs I need to send an alert.

The end result might be useful to others who recieve endless arrays of generally meaningless email (that must be kept) that happen to be sprinkled with the occasional fail or alert where action is required. :)
  13-Jan-2005  10:29   
Usage note -- if you want to get information out of an Outlook message, the property to use is the Body property, e.g.:

strBody = objMessage.Body
strName = ParseTextLinePair(strBody, "Name: ")
  17-Jan-2005  13:30   
Folks, I have a follow up question to the above solution. Is it possible to take the information from the body of the information and forward it that email address? Meaning, I get an email with the body of the message containing two email addresses, I think I can parse the email address using the code above. Once I do that, I'd like to forward the same mail to the email address that I extracted using the code above. Please help.
  17-Jan-2005  14:56   
I have another use for the infomation parsed from an email. First a question.. can I parse the subject line instead of the body?
Also, can I create a file in a public folder based on the pathname I get from the subject line?
Does anyone have the code to do this already?
  17-Jan-2005  16:35   
Marlene, the function above is designed for multi-line text blocks. To parse the subject, all you need is Instr().

The code sample at http://www.outlookcode.com/codedetail.aspx?id=712 shows how to post a file to a folder.
  20-Apr-2005  14:45   
Hi, I'm also very new to this, I wonder would it also be possible to use this code to read the body of an email & to reply with the first 9 lines deleted?
  20-May-2005  09:54   
This is great, its exactly what I need.
Should the line
intLocLabel = Mid(strSource, intLocLabel + intLenLabel)
be
strText = Mid(strSource, intLocLabel + intLenLabel)
?
  23-May-2005  08:25   
Yes, good catch! Thanks!
Page [ 1 2 3 4 5 Next >>  
Post your comment



name        email