Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / New Users / December 2005

Tip: Looking for answers? Try searching our database.

Highlight keyword in mail body

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
wisemax@yahoo.com - 29 Dec 2005 13:33 GMT
I got many emails every day. Can I use VBA to search every mail in my
inbox, and highlight the keywords (I have a list of keywords)? Further,
if a keyword exit in a mail, flag the mail so I will be able to read
these mails first?

For this purpose, if you have other approaches, please advise.

Thanks in advance.

Hong
John Blessing - 29 Dec 2005 13:37 GMT
>I got many emails every day. Can I use VBA to search every mail in my
> inbox, and highlight the keywords (I have a list of keywords)? Further,
[quoted text clipped - 6 lines]
>
> Hong

Yes, if you are adept in VBA and are reading your emails as richtext or html
(or I guess you could highlight plain text with * characters)

Alternatively, use, Tools, Organize, using colors, Automatic formatting.
Wouldn't highlight key phrases within the body, but would be a lot simpler.

Signature

John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters

wisemax@yahoo.com - 29 Dec 2005 14:04 GMT
It was quick!!!!! Thank you John.

I never write VBA code for Outlook, although I write a lot of codes for
Excel. Can you share some codes to get me started? I will modify them
myself.

Hong
John Blessing - 29 Dec 2005 17:39 GMT
> It was quick!!!!! Thank you John.
>
[quoted text clipped - 3 lines]
>
> Hong

Not tested but should give you the general idea:

Private Sub Application_NewMail()

   Dim objOl As Outlook.Application
   Dim objNameSpace As Outlook.NameSpace

   Dim objMailitem As Outlook.MailItem
   Dim objFolder As MAPIFolder
   dim lPos as long

   Dim lIndex As Long

   Set objOl = New Outlook.Application
   Set objNameSpace = objOl.GetNamespace("MAPI")
   objNameSpace.Logon

   Dim strOrderBody As String

   On Error Resume Next
   Set objFolder = objNameSpace.GetDefaultFolder(olFolderInbox)
   lIndex = 1
   Do While lIndex <= objFolder.Items.Count
       Set objMailitem = objFolder.Items(lIndex)
       If Err.Number = 0 Then
          If objMailitem.UnRead  Then
               lpos = instr(1, objmailitem.body ,"yourphrase")
               do while lpos <> 0 and lpos < len(objmailitem.body)
                   if lpos > 0 then
                           objmailitem.body  = left (objmailitem.body
,lpos-1) & "****" & _
                           mid ( objmailitem.body , lpos )
                   end if
                   lpos = instr(lpos + len("yourphrase"), objmailitem.body
,"yourphrase")
               loop
                objmailitem.save
           end if

       end if
       lIndex = lIndex +1
   loop

end sub

Signature

John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook, find/replace,
send newsletters

wisemax@yahoo.com - 29 Dec 2005 14:21 GMT
It was quick!!!!! Thank you John.

I never write VBA code for Outlook, although I write a lot of codes for
Excel. Can you share some codes to get me started? I will modify them
myself.

Hong
Diane Poremsky [MVP] - 29 Dec 2005 15:23 GMT
Visit outlookcode.com - while vba is vba, because outlook uses so many
different windows and doesn't have a macro recorder for you to learn from,
it's not as simple as writing vba for excel (or word).

Signature

Diane Poremsky [MVP - Outlook]
Author, Teach Yourself Outlook 2003 in 24 Hours
Coauthor, OneNote 2003 for Windows (Visual QuickStart Guide)
Need Help with Common Tasks? http://www.outlook-tips.net/beginner/

Outlook Tips: http://www.outlook-tips.net/
Outlook & Exchange Solutions Center: http://www.slipstick.com
Subscribe to Exchange Messaging Outlook newsletter:
EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM

> It was quick!!!!! Thank you John.
>
[quoted text clipped - 3 lines]
>
> Hong
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.