CREATE A CONTACT LIST IN OUTLOOK 2016 FOR FREE
Save End With End If sSenderName = Recipient.Manage your mailbox overloaded with unwanted emails more efficiently Try Clean Email for Free Outlook 20 Email1AddressType = oMail.SenderEmailType. Email1Address = oMail.SenderEmailAddress. Do you still want to add it as a new contact?", vbQuestion + vbYesNo, "Contact Adder") If response = vbNo Then bContinue = False End If End If If bContinue Then Set oContact = colItems.Add(olContactItem) With oContact. Thanks for this, but i get a error: "next without for" Here is my code: Public Sub AddAddressesToContacts() Dim folContacts As Outlook.MAPIFolder Dim colItems As Outlook.Items Dim oContact As Outlook.ContactItem Dim oMail As Outlook.MailItem Dim obj As Object Dim oNS As Outlook.NameSpace Dim response As VbMsgBoxResult Dim bContinue As Boolean Dim sSenderName As String On Error Resume Next Set oNS = Application.GetNamespace("MAPI") Set folContacts = oNS.GetDefaultFolder(olFolderContacts) Set colItems = folContacts.Items For Each obj In If obj.Class = olMail Then Set oContact = Nothing bContinue = True sSenderName = "" Set oMail = obj sSenderName = oMail.SentOnBehalfOfName If sSenderName = " " Then sSenderName = oMail.SenderName End If Set oContact = colItems.Find(" = '" & sSenderName & "'") If Not (oContact Is Nothing) Then response = MsgBox("This appears to be an existing contact: " & sSenderName & ". Email1AddressType = oMail.SenderEmailType Email1Address = oMail.SenderEmailAddress Set oContact = colItems.Add(olContactItem) Do you still want to add it as a new contact?", vbQuestion + vbYesNo, "Contact Adder") Response = MsgBox("This appears to be an existing contact: " & sSenderName & ". Set oContact = colItems.Find(" = '" & sSenderName & "'") Set folContacts= oNS.GetDefaultFolder(olFolderContacts)įor Each obj In Set oNS = Application.GetNamespace("MAPI") ' Select the mail folder and any items to add to contacts, then run the macro ' The AddAddressesToContacts procedure can go in any Module
CREATE A CONTACT LIST IN OUTLOOK 2016 CODE
Ken adds: "If this were 2007 or later code only I’d use PropertyAccessor to pick up the PR_SENT_REPRESENTING_ADDRTYPE and PR_SENT_REPRESENTING_EMAIL_ADDRESS properties instead of using SenderEmailAddress and SenderEmailAddressType." This macro is compliments of Outlook MVP and developer Ken Slovak from Create Contacts for All Senders in a Folder This will allow you to peruse the messages and select just the sender's whose address you need saved. Tip: it might be helpful to copy messages from sender's whose address you want to save to a new folder then run it on that folder. Select the messages you want to create contacts from and run it. If you need to run it on several folders, add a toolbar button for it. To use it, copy the code to Outlook's VB editor. So the email addresses may not be accurate (for example mails sent to a mailing list will often show as sent by the list address, not the actual sender.) Because Ken wanted to only use the OOM and so it's not restricted to 2007 or later only, he didn’t use the MAPI properties for SentOnBehalfOf* other than for name. This macro will work in any folder, on all selected items in that folder.Īny selected mail items will be harvested. This macro solves the problem by automating the process - it goes through each message in the selected folder and creates a Contact for the sender.įor utilities that can do this or if you want to add the addresses of all people you send messages to (either new messages or replies) see Add addresses automatically to Microsoft Outlook Contacts. The user is right - its a slow, painful process to select each message, right click and choose Add to contacts.
Does anyone have the micro basic code to set up a macro to add contacts from the personal favorite folder? I imported all of my emails into my new Microsoft Outlook 2003 but going through all the emails individually to add contacts is horrible when you have thousands of emails. My contact list on a prior system was deleted.