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
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
--
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