How to clean duplicate/empty e-mail address fields in Outlook contacts

Status
Not open for further replies.
M

mi6

Hello,

just in case you want all your contacts' e-mail address fields fixed (duplicates, empty fields, etc.), here's a macro which I wrote myself:

Code:
Sub Repair_E_Mail_Addresses() 
 
Dim objApp As Outlook.Application 
    Dim objNS As NameSpace 
    Dim objSelection As Outlook.Selection 
    Dim objItem As ContactItem 
    Dim str() As String, yesno As String 
    Dim objcount, i As Integer
   Set objApp = CreateObject("Outlook.Application") 
    Set objNS = objApp.GetNamespace("MAPI") 
    Set objSelection = objApp.ActiveExplorer.Selection 
   
   MsgBox ("Repairing " & objSelection.count & " contacts.")
  
       'the following "i = 0 to 2" loop is to ensure that both empty fields 
        'are removed by shifting address 2 and 3 up and, afterwards, all 
        'duplicate entries are removed 
       
       For i = 0 To 2 
            Select Case LCase(objItem.Email1Address) 
                Case "" 
                    objItem.Email1Address = objItem.Email2Address 
                    objItem.Email2Address = objItem.Email3Address 
                    objItem.Email3Address = "" 
                Case LCase(objItem.Email2Address) 
                    objItem.Email2Address = objItem.Email3Address 
                Case LCase(objItem.Email3Address) 
                    objItem.Email3Address = "" 
                Case Else 
            End Select 
            Select Case LCase(objItem.Email2Address) 
                Case "" 
                    objItem.Email2Address = objItem.Email3Address 
                    objItem.Email3Address = "" 
                Case LCase(objItem.Email1Address) 
                    objItem.Email2Address = "" 
                Case LCase(objItem.Email3Address) 
                    objItem.Email3Address = "" 
                Case Else 
            End Select 
            Select Case LCase(objItem.Email3Address) 
                Case LCase(objItem.Email1Address) 
                    objItem.Email3Address = "" 
                Case LCase(objItem.Email2Address) 
                    objItem.Email3Address = "" 
                Case Else 
            End Select 
        Next i 
        objItem.Save 
    
 
End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
S Clean Up Conversation Anomaly? Using Outlook 4
W The number one raw material applied in producing the duvet, is clean and slight to your pores Using Outlook 0
Retired Geek Junk Folder Clean Up Rules Exchange Server Administration 1
J Remove text to Clean Up Outlook VBA and Custom Forms 1
Diane Poremsky How to clean up Outlook's Forms Cache Using Outlook 0
R Clean out the "Other Calendars" form Outlook 2007 sp2 Using Outlook 1
Rupert Dragwater Duplicate email in Folder Using Outlook 7
L Duplicate calendar entries in Outlook 365 Using Outlook 3
J Recommendations for Outlook Duplicate Email Remover Using Outlook 6
D Duplicate Emails on Phone and Tablet Using Outlook 0
I Google Calendar <calendar-notification@google.com> appearing as a duplicate entry Using Outlook 2
O Delete duplicate emails - subscription notifications Using Outlook 5
T Deleting duplicate emails Using Outlook 2
S Receiving duplicate messages from RSS feeds Using Outlook 3
M Duplicate Primary Mail Accounts outlook 2010 Using Outlook 0
C Auto categorize duplicate subjects Outlook VBA and Custom Forms 11
K Outlook 2010 duplicate download emails 1 inbox 1 PST no updates Using Outlook 3
C Don't forward duplicate Using Outlook 0
E Duplicate, nested account folders on ATT server Using Outlook 10
S Duplicate emails Using Outlook 2
O Remove duplicate mail items Outlook VBA and Custom Forms 6
F Avoid sending duplicate using Outlook script Outlook VBA and Custom Forms 2
O How to delete duplicate RSS messages? Using Outlook 6
MattC Problem with Outlook 2007 & iCloud / duplicate tasks Using Outlook 1
Horsepower Duplicate RSS feeds Using Outlook 5
M How to duplicate content of one field in another field? Outlook VBA and Custom Forms 3
P Duplicate Standard Views Using Outlook 3
J Duplicate contacts Using Outlook 1
T Duplicate emails in different "sent" boxes. Using Outlook 2
N Deleting Duplicate Calendar Entires Outlook VBA and Custom Forms 2
J Duplicate Reminders Using Outlook 5
J Duplicate Attachments in Content.Outlook Using Outlook 4
J Duplicate emails on some computers, but not on others Using Outlook 1
M best duplicate contact remover? Using Outlook 6
Mr Mayor Duplicate Task LIST, not "duplicate tasks".... Using Outlook 10
V Duplicate and triplicate messages in Inbox Outlook 2013 Using Outlook 20
M How to remove duplicate history items BCM (Business Contact Manager) 7
D Isn't there an easy way to remove duplicate contacts in outlook? Using Outlook 1
H Duplicate E-mails and Wetransfer Using Outlook 4
J Duplicate email when receiving email sent To: me and CC to a group I belong to Using Outlook 16
O Duplicate folders in Outlook 2003 Using Outlook 3
C duplicate e-mails from gmail? Using Outlook 1
T Outlook 2013 Duplicate Recipients Using Outlook 9
wisedave Duplicate Emails Downloading Everytime I Open Outlook Using Outlook 1
C Duplicate emails from pop but only for certain date range? Using Outlook 4
S Duplicate Read Receipt Using Outlook 4
S can't delete duplicate account under Outlook 2007 (Win 7) Using Outlook 16
I Duplicate contacts in iPhone resulting from LinkedIn connector in Exchange Using Outlook 3
A Remove shared Contacts duplicate entry Using Outlook 3
R Duplicate tasks Outlook 2010 Using Outlook 1

Similar threads

Back
Top