Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook 2000 VBA envelope removal

Status
Not open for further replies.

LizardKingSchwing

Programmer
Oct 12, 2001
96
NL
Right so what I want to do is use the RemoveNewMailIcon vba code from link below to remove the Outlook New Mail Envelope when a mail with [Norton Antispam] in the
Subject comes in


Currently I have it set as follows

Private Sub Application_NewMail()
RemoveNewMailIcon
End Sub

What I need is some vba code to

Private Sub Application_NewMail()

'Check 1st the mails subject
'see if it has the string [Norton Antipam]
'if it does call the below
RemoveNewMailIcon

'if not then do nothing
End Sub


Anyone know how to do this or have any tips ,hints etc.

Cheers

LK--<
 
Got some more info. from below link


Then I put in this code ....

--------------------------------------------
Private Sub Application_NewMail()
Dim oApp As Application
Dim oNS As NameSpace
Dim oMsg As Object
Dim oFolder As Object


Set oApp = New Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oFolder = oNS.GetDefaultFolder(olFolderInbox)
strControl = 0

For Each oMsg In oFolder.Items
With oMsg
If oMsg.Class = olMail Then
If oMsg.UnRead = True Then
If InStr(1, .Subject, "[Norton AntiSpam]") > 0 Then
'MsgBox "New Spam"
RemoveNewMailIcon
Exit For
End If
End If
End If
End With
Next
End Sub
-------------------------------------------------------

It works but causes high utilisation every time a mail comes in .... Anyone wanna tweak the above or got a better way to do it ???

Cheers

LK-<
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top