Muhammad Burhan
asked on
Macro for Delete Duplicate Emails in outlook2010
Hey Experts!!
Consider this code as an example, is it possible to create a macro which compare 'subject' of every incoming mail and delete duplicates then and there ?
if its possible so please provide your valuable assistance.
Consider this code as an example, is it possible to create a macro which compare 'subject' of every incoming mail and delete duplicates then and there ?
if its possible so please provide your valuable assistance.
Public Sub ProcessingzabbixEmails(Item As Outlook.MailItem)
Dim objParent As Outlook.Folder
Dim objFolder As Outlook.Folder
Dim objProductionFldr As Outlook.Folder
Dim strSubject As String
Dim objProbEmail As Outlook.MailItem
Set objParent = Outlook.Session.GetDefaultFolder(olFolderInbox).Parent
Set objProductionFldr = objParent.Folders("Current_Production_Alerts")
If Right(Item.Subject, 2) = "OK" Then
Set objFolder = objParent.Folders("Archived_Production_Alerts")
' Find Matching Email
strSubject = Left(Item.Subject, Len(Item.Subject) - 2) & "PROBLEM"
Set objProbEmail = objProductionFldr.Items.Find("[Subject] = '" & Replace(strSubject, "'", "''") & "'")
objProbEmail.UnRead = False
Item.Move objFolder
objProbEmail.Move objFolder
Item.UnRead = False
Item.Move objFolder
Else
Item.UnRead = True
Item.Move objProductionFldr
End If
End Sub
Thankx
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
You should just continue with my script, and test where there are errors.
Start with adding a msgbox command after
As with all code, you fix it step by step.
Start with adding a msgbox command after
Private Sub objNewMailItems_ItemAdd(ByVal Item As Object)
'add this line
msgbox "This sub objNewMailItems_ItemAdd fired correctly!"
As with all code, you fix it step by step.
ASKER
Got what I need from http://www.slipstick.com/developer/processing-incoming-e-mails-with-macros/
Your first Script works after some editing..
Thankx!
Your first Script works after some editing..
Thankx!
ASKER
found another script,
Open in new window
But,