A Microsoft Outlook email forum. Outlook Banter

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.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

String in msg body



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 9th 06, 03:56 PM posted to microsoft.public.outlook.program_vba
gamename
external usenet poster
 
Posts: 12
Default String in msg body

Hi,

Is there a quick way to determine if a string exists somewhere an
email's body without having to read it line-by-line?

TIA,
-T

Ads
  #2  
Old August 9th 06, 04:55 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default String in msg body

You have to parse Item.Body to see if the string is in there no matter what
you do.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"gamename" wrote in message
oups.com...
Hi,

Is there a quick way to determine if a string exists somewhere an
email's body without having to read it line-by-line?

TIA,
-T


  #3  
Old August 10th 06, 01:34 AM posted to microsoft.public.outlook.program_vba
gamename
external usenet poster
 
Posts: 12
Default String in msg body

Ken Slovak - [MVP - Outlook] wrote:
You have to parse Item.Body to see if the string is in there no matter what
you do.


So, you're saying that I have to read Item.Body line-by-line, and look
in each string for a substring . There is no separate method to simply
verify that a certain string does or does not exist somewhere inside of
Item.Body. Correct?


--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"gamename" wrote in message
oups.com...
Hi,

Is there a quick way to determine if a string exists somewhere an
email's body without having to read it line-by-line?

TIA,
-T


  #4  
Old August 10th 06, 03:30 AM posted to microsoft.public.outlook.program_vba
Michael Bednarek
external usenet poster
 
Posts: 15
Default String in msg body

On 9 Aug 2006 07:56:30 -0700, "gamename" wrote in
microsoft.public.outlook.program_vba:

Is there a quick way to determine if a string exists somewhere an
email's body without having to read it line-by-line?


I don't know what you mean by "read it line-by-line"; AFAIK there is no
such method to access the body of a message.

This is the normal method to determine the existence and position of a
string in a message's body:
lngP1 = InStr(ActiveInspector.CurrentItem.Body,"fubar")

For details, see Help on "Function InStr".

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
  #5  
Old August 10th 06, 02:52 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default String in msg body

As Michael said you just use Item.Body to read the entire body as one long
string. Then use InStr or some other string function to look for what you
want.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"gamename" wrote in message
ups.com...
Ken Slovak - [MVP - Outlook] wrote:
You have to parse Item.Body to see if the string is in there no matter
what
you do.


So, you're saying that I have to read Item.Body line-by-line, and look
in each string for a substring . There is no separate method to simply
verify that a certain string does or does not exist somewhere inside of
Item.Body. Correct?


  #6  
Old August 10th 06, 10:05 PM posted to microsoft.public.outlook.program_vba
gamename
external usenet poster
 
Posts: 12
Default String in msg body

Thanks guys, that answers my question.

When I said 'line-by-line', I meant a collection of strings delimited
by control characters (like newline or null). Some environments will
see entities similar to Body as a set of individual lines, and others
treat it like a single string a chars.

Evidently then, a mail message body in outlook is treated vb as one
long string rather than lots of shorter ones.

I'm rather new to VB, so I'm still getting the hang of it.

Thanks again,
-T

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I include quotes around a word in text string? Maureen Outlook and VBA 3 March 3rd 06 11:10 AM
last string in txt file Leech Outlook and VBA 1 February 10th 06 07:13 AM
Need String from Email Subject CondtllyFrmttd Outlook and VBA 1 January 25th 06 04:26 PM
Use Part of Subject as String CondtllyFrmttd Outlook - General Queries 0 January 23rd 06 06:57 PM
string variable that contains formatting Martin Outlook and VBA 4 January 19th 06 09:49 AM


All times are GMT +1. The time now is 10:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.