If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
reading message body line by line in VBA
Greetings --
I need to read the body of an email message one line at a time, much as you would do with Line Input when reading a text file. Have code working that opens an email item, and I can read the MailItem.Body into a string variable. In my situation (long story), it would be easier if I could read the body as a series of individual lines of text. Any suggestions? TIA... Mark |
Ads |
#2
|
|||
|
|||
reading message body line by line in VBA
Use Split on vbCRLF if it's plain text.
Dim aryLines() As String aryLines = Split(strBody, vbCRLF) -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm "Mark VII" wrote in message ... Greetings -- I need to read the body of an email message one line at a time, much as you would do with Line Input when reading a text file. Have code working that opens an email item, and I can read the MailItem.Body into a string variable. In my situation (long story), it would be easier if I could read the body as a series of individual lines of text. Any suggestions? TIA... Mark |
#3
|
|||
|
|||
reading message body line by line in VBA
Assuming the body has line breaks, you could read it into an array using the Split() function, then read element of the array:
arr = Split(myItem.Body, vbCrLf) MsgBox arr(0) etc. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Mark VII" wrote in message ... Greetings -- I need to read the body of an email message one line at a time, much as you would do with Line Input when reading a text file. Have code working that opens an email item, and I can read the MailItem.Body into a string variable. In my situation (long story), it would be easier if I could read the body as a series of individual lines of text. Any suggestions? TIA... Mark |
#4
|
|||
|
|||
reading message body line by line in VBA
Thanks a million for the suggestions. Just did a "quick and dirty" test with
Split, and it seems to work. I'd much rather read the array that have to save a text file and start parsing it. Mark |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
how to preserve line breaks in the message | Igor S | Outlook - General Queries | 4 | December 11th 07 02:04 AM |
Is is possible to change the body line size? | eran kaufman | Outlook - General Queries | 0 | June 27th 07 09:56 AM |
Reply in Outlook cursor on TO line instead of body of message | [email protected] | Outlook - General Queries | 0 | June 27th 06 09:21 PM |
See attachment line in new message? | cjlatta | Outlook - Installation | 1 | June 15th 06 11:16 PM |
How to input line break in the body of an email defined in vb. | Xluser@work | Outlook and VBA | 1 | February 22nd 06 02:20 PM |