How to Quickly Export Multiple Contacts to One VCard File with Outlook VBA

If you have multiple contacts in your Outlook and want to export them to a single vCard file, instead of separate files, you can use the smart method introduced in this article.

For instance, you need to send hundreds of contacts to some else. Rather than sending them as separate vCard files, you may be eager to combine them into a single vCard file and then send it. Actually, my previous article – “How to Export Multiple Outlook Contacts as a Single VCard File” has introduced a method. However, that approach demands you to have a Gmail account and use “Import and Export” feature of Gmail. In a nutshell, that is pretty cumbersome. Therefore, here we will introduce a handier method to you.Quickly Export Multiple Contacts to One VCard File with Outlook VBA

Quickly Export Multiple Contacts to One vCard File

  1. First off, launch your Outlook application.
  2. Then, tap on “Alt + F11” keys to access VBA editor.
  3. Next, in the new window, put the VBA code into a module.
Sub ExportMultipleContactsIntoOneVCardFile()
    Dim objSelection As Outlook.Selection
    Dim strLocalDrive, strFolder As String
    Dim i As Long
    Dim objContact As Outlook.ContactItem
    Dim strVCardFile As String
 
    'Get all selected contacts
    Set objSelection = Outlook.Application.ActiveExplorer.Selection
 
    If Not objSelection Is Nothing Then
       'Save contacts in "E:\Temp Contacts\"
       strLocalDrive = "E:"
       strFolder = "Temp Contacts"
       MkDir (strLocalDrive & "\" & strFolder & "\")
 
       'Save all selected contacts as separate vCards
       For i = objSelection.Count To 1 Step -1
           If TypeName(objSelection(i)) = "ContactItem" Then
              Set objContact = objSelection(i)
 
              strVCardFile = strLocalDrive & "\" & strFolder & "\" & objContact.FullName & ".vcf"
              objContact.SaveAs strVCardFile, olVCard
           End If
       Next
 
       'Use cmd to merge all exported vCard files into one
       Shell "cmd.exe /K" & strLocalDrive & " & CD " & strFolder & " & copy *.vcf MergedContact.vcf"
    End If
End Sub

VBA Code - Quickly Export Multiple Contacts into One VCard File

  1. After that, add this macro to Quick Access Toolbar with reference to “How to Run VBA Code in Your Outlook“.
  2. Eventually, you can try this macro right now.
  • For a start, select the contacts which you want to export.
  • Then, click the macro button in Quick Access Toolbar.Run Macro on Selected Contacts
  • Later you will see a command prompt window, which indicates that all the contacts are merged into one.Command Prompt
  • Now, you can go to “E:\Temp Contacts” folder in your Windows Explorer.
  • In this local folder, you will find a vCard file named as “MergedContact”, which is the file containing all the selected contacts.Merged vCard File

Repair Your Outlook Data after Crashes

As Outlook is susceptible to corruption, you need to take good care of your PST file. For instance, you need to keep closing your Outlook in proper manner. Also, it is suggested to never click unknown links or download attachments embedded in emails. Moreover, you had better get hold of a powerful PST repair utility, such as DataNumen Outlook Repair. With it, even if your Outlook file gets corrupt, you still can repair it with effortless ease.

Author Introduction:

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

Comments are closed.