How to Quickly Convert the Members of a Contact Group into Individual Contacts via Outlook VBA

When you get a contact group from others, sometimes maybe you want to convert all its members into individual contacts, rather than an original contact group. This article will help you quickly accomplish it via Outlook VBA.

Actually, in my previous article – “4 Steps to Extract Individual Contacts from Distribution List in Outlook”, I have introduced a clunky way to realize it. In short, that means is to firstly save the contact group as Text file, then transfer it to a CSV file and lastly import the CSV file into your Outlook. There is no denying that it is troublesome and sometimes error prone. Therefore, here we will expose another approach, which is far more simple and faster in that it uses VBA. Read on to get the detailed steps and codes.

Convert the Members of a Contact Group into Individual Contacts

  1. At the very outset, start your Outlook as normal.
  2. Then press the shortcuts – “Alt + F11” key buttons to access the Outlook VBA editor.
  3. Next the “Microsoft Visual Basic for Applications” window will open up.
  4. Subsequently, you can insert a new module by clicking “Insert” button in the toolbar and selecting “Module” from the drop-down list.
  5. After that, in the new module, you ought to copy and paste the following VBA codes.
Sub CreateContactsfromContactGroup()
    Dim objContacts As Outlook.Items
    Dim objContact As Outlook.ContactItem
    Dim objSelectedContactGroup As Outlook.DistListItem
    Dim objMember As Outlook.recipient
    Dim strFullName As String
    Dim strEmailAddress As String
    Dim i As Long
    Dim n As Long
    Dim strFilter As String
    Dim objNewContact As Outlook.ContactItem
 
    Set objContacts = Application.Session.GetDefaultFolder(olFolderContacts).Items
    Set objSelectedContactGroup = Application.ActiveExplorer.Selection.Item(1)
 
    For i = 1 To objSelectedContactGroup.MemberCount
        'Get each member's name and address
        Set objMember = objSelectedContactGroup.GetMember(i)
        strFullName = objMember.Name
        strEmailAddress = objMember.Address
 
        'Check if the member has been in your default Contacts folder
        For n = 1 To 3
            strFilter = "[Email" & n & "Address] = " & strEmailAddress
            Set objContact = objContacts.Find(strFilter)
            If Not objContact Is Nothing Then
               Exit For
            End If
        Next n
 
        'Create new contacts for the members not in default Contacts folder
        If objContact Is Nothing Then
           Set objNewContact = Application.CreateItem(olContactItem)
           With objNewContact
                .FullName = strFullName
                .Email1Address = strEmailAddress
                .Save
           End With
        End If
    Next i
 
    MsgBox ("Convert Complete!")
End Sub

VBA Codes - Convert the Members of a Contact Group into Individual Contacts

  1. Then you need to exit the VBA editor window.
  2. Next add the newly added macro to Quick Access Toolbar.
  3. Finally you can have a try:
  • Firstly, you ought to save the received contact group to Contacts folder.
  • Then pitch on the contact group,
  • Next click the macro button in the Quick Access Toolbar.Click the New Macro Button in Quick Access Toolbar
  • Finally, the macro will work at once. When Outlook completes converting the members into individual contacts successfully, you will get a message, like the following:Convert the Members of a Contact Group into Individual Contacts

Extract Maximum Data from Compromised PST

Do you know how to deal with a corrupt PST file and extract maximum data from such a PST file? Some users may be reluctant to thinking about it. However, it is an unquestioned fact that PST file is vulnerable. Also, you can’t accurately predict when it gets damaged. Therefore, the best way is to make regular backups of PST files. In addition, out of insurance, you should prepare a well-proven repair tool in vicinity, such as DataNumen Outlook Repair, which will come in handy one day.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair mdf and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.