![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
Hello
I'm using Outlook 2007 on Exchange and I'm having an email with a huge amount of recipiens in the To and Co lines and I woul like to collect these addresses into one of the subfolder of my Contacts folder. OK, I can copy one email address at a time if I select only one address, then pick out the "Add to Outlook Contacts" command from the mouse right click menu. Evidently is this procedure more than retardatory. If I select two or more addresses from any of both lines, then there isn't any such "Add to Outlook Contacts" command on the content menu and I can only copy the selected addresses to clipboard. As I can see nad understand only the display name parts of the addresses are copied to cipboard and these data are without real address not useful for me. I'm sure that it should be some way to do this with VBA code. Could anybody help me with a piece of code or a hint? Ivan |
Ads |
#2
|
|||
|
|||
![]()
Get the Recipients collection of the mail item and iterate that collection.
You can harvest whatever information you want from each Recipient (whatever is available on that object). When adding contacts using code you will not get any warning dialogs if you try to add a duplicate contact. So any code must search in the Contacts to see if such a contact already exists. How you determine a duplicate is up to you. Names can be slightly different (Richard, Rich, Ricky) and so on, so you have to account for that. It's somewhat more complicated than it sounds like it would be. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Ivan" wrote in message ... Hello I'm using Outlook 2007 on Exchange and I'm having an email with a huge amount of recipiens in the To and Co lines and I woul like to collect these addresses into one of the subfolder of my Contacts folder. OK, I can copy one email address at a time if I select only one address, then pick out the "Add to Outlook Contacts" command from the mouse right click menu. Evidently is this procedure more than retardatory. If I select two or more addresses from any of both lines, then there isn't any such "Add to Outlook Contacts" command on the content menu and I can only copy the selected addresses to clipboard. As I can see nad understand only the display name parts of the addresses are copied to cipboard and these data are without real address not useful for me. I'm sure that it should be some way to do this with VBA code. Could anybody help me with a piece of code or a hint? Ivan |
#3
|
|||
|
|||
![]()
Thank you Ken,
I play with some VBA code and below is a program for extracting the display names and the addresses from all the emails od the specific outlook folder. The results are in the Immediate window of MVB and an user can easily change that part of the code: Sub ExtractRecipientsFromEmail() Dim OlApp As Outlook.Application Dim MailObject As Object Dim RecipientObject As Object Dim Email As String Dim NS As NameSpace Dim Folder As MAPIFolder Set OlApp = CreateObject("Outlook.Application") Set NS = ThisOutlookSession.Session Set Folder = NS.PickFolder For Each MailObject In Folder.Items If MailObject.Class = olMail Then For Each RecipientObject In MailObject.Recipients If RecipientObject.Address Like "*@*" Then Debug.Print RecipientObject.Name, RecipientObject.Address End If Next End If Next Set OlApp = Nothing Set MailObject = Nothing Set RecipientObject = Nothing End Sub Ivan "Ken Slovak - [MVP - Outlook]" wrote in message ... Get the Recipients collection of the mail item and iterate that collection. You can harvest whatever information you want from each Recipient (whatever is available on that object). When adding contacts using code you will not get any warning dialogs if you try to add a duplicate contact. So any code must search in the Contacts to see if such a contact already exists. How you determine a duplicate is up to you. Names can be slightly different (Richard, Rich, Ricky) and so on, so you have to account for that. It's somewhat more complicated than it sounds like it would be. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Ivan" wrote in message ... Hello I'm using Outlook 2007 on Exchange and I'm having an email with a huge amount of recipiens in the To and Co lines and I woul like to collect these addresses into one of the subfolder of my Contacts folder. OK, I can copy one email address at a time if I select only one address, then pick out the "Add to Outlook Contacts" command from the mouse right click menu. Evidently is this procedure more than retardatory. If I select two or more addresses from any of both lines, then there isn't any such "Add to Outlook Contacts" command on the content menu and I can only copy the selected addresses to clipboard. As I can see nad understand only the display name parts of the addresses are copied to cipboard and these data are without real address not useful for me. I'm sure that it should be some way to do this with VBA code. Could anybody help me with a piece of code or a hint? Ivan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Extract delimted list of email addresses from a distribution list? | Vorv | Outlook - Using Contacts | 7 | July 31st 08 11:13 PM |
How do I extract and save a list of email addresses in Outloook? | Grady | Outlook - General Queries | 2 | March 25th 08 11:10 AM |
how to extract email addresses from outlook express using php...please help.. | vidya | Outlook - General Queries | 2 | July 31st 07 10:48 AM |
Extract email addresses from Distribution LIst in Global Address List | tthomas | Outlook and VBA | 2 | June 22nd 06 12:02 AM |
Program to "extract" email addresses from OE? | David Baxter | Outlook Express | 4 | May 13th 06 06:32 PM |