D
Daniel Dupont
Hi all,
here is the result of my work. I wanted to publish it because it has been
quite long to experiment.
*** warning ****
This scripts apply only on standard mails. So, the script crashes with:
-notifications
-pgp signed mails
*** warning ****
*** vba script ***
Private Sub CommandButton1_Click()
' REMARK
' 1 - When I made it, it was launched by a button
' 2 - you need a textbox1 to see the result
' REMARK
Dim objOutlook As Object 'Outlook.Application
Dim objNameSpace As Object 'Outlook.NameSpace
Dim objInbox As Object 'Outlook.MAPIFolder
Dim copyInbox As Object 'Outlook.MAPIFolder
Dim objItem As Object 'Outlook.MailItem
Dim formerobjItem As Object 'Outlook.MailItem
Dim MyItems As Object
Dim lngRow As Long
Dim myS As Long
myS = 0
Set objOutlook = GetObject(, "Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objInbox = objNameSpace.Folders(1) ' name of PST
Set objInbox = objInbox.Folders("My French Inbox")
Set MyItems = objInbox.Items
MyItems.Sort "[ReceivedTime]", False
For Each objItem In MyItems
If myS = 1 Then
If (formerobjItem.ReceivedTime = objItem.ReceivedTime)
And (formerobjItem.Subject = objItem.Subject)
Then
lngRow = lngRow + 1
formerobjItem.Delete
End If
End If
Set formerobjItem = objItem
myS = 1
Next
TextBox1.Text = "finished: " & lngRow & " mails removed"
Set objItem = Nothing
Set objInbox = Nothing
Set objNameSpace = Nothing
Set objOutlook = Nothing
End Sub
*** vba script ***
I imagine this procedure is sufficient to understand what to do. Anyway, if
you are not sure of what you are doing, buy a commercial product. It is
about 10 to 30 euros/us$, you will avoid loosing your time and crying all
the night because of data loss !
Regards,
DD
keywords: VBA VBS Visual Basic remove duplicate mail mails email emails
e-mail e-mails removed clean cleaner dups removal doublons dédoublonage
dédoublonnage outlook
here is the result of my work. I wanted to publish it because it has been
quite long to experiment.
*** warning ****
This scripts apply only on standard mails. So, the script crashes with:
-notifications
-pgp signed mails
*** warning ****
*** vba script ***
Private Sub CommandButton1_Click()
' REMARK
' 1 - When I made it, it was launched by a button
' 2 - you need a textbox1 to see the result
' REMARK
Dim objOutlook As Object 'Outlook.Application
Dim objNameSpace As Object 'Outlook.NameSpace
Dim objInbox As Object 'Outlook.MAPIFolder
Dim copyInbox As Object 'Outlook.MAPIFolder
Dim objItem As Object 'Outlook.MailItem
Dim formerobjItem As Object 'Outlook.MailItem
Dim MyItems As Object
Dim lngRow As Long
Dim myS As Long
myS = 0
Set objOutlook = GetObject(, "Outlook.Application")
Set objNameSpace = objOutlook.GetNamespace("MAPI")
Set objInbox = objNameSpace.Folders(1) ' name of PST
Set objInbox = objInbox.Folders("My French Inbox")
Set MyItems = objInbox.Items
MyItems.Sort "[ReceivedTime]", False
For Each objItem In MyItems
If myS = 1 Then
If (formerobjItem.ReceivedTime = objItem.ReceivedTime)
And (formerobjItem.Subject = objItem.Subject)
Then
lngRow = lngRow + 1
formerobjItem.Delete
End If
End If
Set formerobjItem = objItem
myS = 1
Next
TextBox1.Text = "finished: " & lngRow & " mails removed"
Set objItem = Nothing
Set objInbox = Nothing
Set objNameSpace = Nothing
Set objOutlook = Nothing
End Sub
*** vba script ***
I imagine this procedure is sufficient to understand what to do. Anyway, if
you are not sure of what you are doing, buy a commercial product. It is
about 10 to 30 euros/us$, you will avoid loosing your time and crying all
the night because of data loss !
Regards,
DD
keywords: VBA VBS Visual Basic remove duplicate mail mails email emails
e-mail e-mails removed clean cleaner dups removal doublons dédoublonage
dédoublonnage outlook