How to Quickly Create an Outlook Contact Group from All Contacts in a Windows Folder

Maybe you have numerous contacts stored as vCard files in a Windows folder. If you would like to create an Outlook contact group from all these contacts, you could use the method introduced in this article.

From my previous article – “How to Batch Send an Outlook Email to All Contacts Stored in a Windows Folder”, you can learn a method to rapidly send an email to all contacts in a Windows folder. Yet, if you frequently need to send such an email to these contacts, it is actually suggested to create an Outlook contact group from them. In the followings, we will teach you how to achieve it with VBA code.

Quickly Create an Outlook Contact Group from All Contacts in a Windows Folder

Create a Contact Group from All Contacts in a Windows Folder

  1. At the very outset, start your Outlook application.
  2. Then, press “Alt + F11” key buttons to access Outlook VBA editor.
  3. In the subsequent window, put the following VBA code into a module which is not being used.
Sub CreateContactGroupFromAllContactsInWindowsFolder()
    Dim objWindowsFolder As Object
    Dim objTempMail As Outlook.MailItem
    Dim objContactGroup As Outlook.DistListItem
    Dim objFileSystem As Object
    Dim objFile As Object
    Dim objVCard As Object
    Dim objInspectors As Outlook.Inspectors
    Dim objWsShell As Object

    'Select a Windows folder
    Set objShell = CreateObject("Shell.Application")
    Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a Windows Folder:", 0, "")
    If Not objWindowsFolder Is Nothing Then
       'Create a temp email
       Set objTempMail = Outlook.Application.CreateItem(olMailItem)
       'Create a new contact group
       Set objContactGroup = Outlook.Application.CreateItem(olDistributionListItem)
       Set objFileSystem = CreateObject("Scripting.FileSystemObject")
       Set objWindowsFolder = objFileSystem.GetFolder(objWindowsFolder.self.Path & "\")
       'Process all vCard files in the Windows folder
       For Each objFile In objWindowsFolder.Files
           If objFileSystem.GetExtensionName(objFile) = "vcf" Then
              Set objVCard = objFile
              Set objInspectors = Outlook.Application.Inspectors
              If objInspectors.Count = 0 Then
                 Set objWsShell = CreateObject("WScript.Shell")
                 objWsShell.Run (Chr(34) & objVCard.Path & Chr(34))
                 Do Until objInspectors.Count = 1
                 objTempMail.Recipients.Add (objInspectors.Item(1).CurrentItem.Email1Address)
                 objInspectors.Item(1).Close olDiscard
                 'Add the contact email address to the new group
                 objContactGroup.AddMembers objTempMail.Recipients
              End If
           End If
       'Display the new contact group
       With objContactGroup
            .DLName = "Windows Contacts"
       End With
       objTempMail.Close olDiscard
    End If
End Sub

Create a Contact Group from All Contacts in a Windows Folder

  1. After that, you can run this macro by “F5” key button.
  2. Later, you’ll be required to select a Windows folder in the popup dialog box.Select a Windows Folder
  3. Lastly, the macro will start to work. When it finishes, a new contact group will display, like the following screenshot:New Contact Group

Get Back Maximum Outlook Data after Damage

As we all know, Outlook file is not immune from damage like Word documents or Excel workbooks. Various factors, including hardware issues, software failures or viruses, etc., can lead to PST file damage. Hence, in order to take immediate relief measures, you’d better keep a remarkable and reliable PST fix tool nearby, such as DataNumen Outlook Repair. It is able to extract maximum data from corrupted Outlook file with utmost ease.

Author Introduction:

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

Comments are closed.