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.
Thread starter Similar threads Forum Replies Date
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 New Slipstick.com Articles 0
R Clean out the "Other Calendars" form Outlook 2007 sp2 Using Outlook 1
C Outlook 2010 does not Clean Messages from Server Using Outlook 1
P Sent mails remain in Drafts. How do I clean out the Drafts folder ? Using Outlook 3
H How to clean .pst file Using Outlook 6
A need to clean .pst files on outlook. email box full__ Using Outlook 5
S EMC not working after clean install exchange 2010 on win 2k8 R2 Exchange Server Administration 7
H Outlook 2010: Conversation Clean Up and Ignore only functional in Cached Exchange mode? Using Outlook 1
C exchange clean install, servermanager error, server 2008sp2 Exchange Server Administration 3
W "Unable to Clean free/busy information on the server" 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
Similar threads


















































Top