How to Quickly Export Multiple Outlook Contact Groups into a PDF File

At times, you may want to export multiple Outlook contact groups into a PDF file. Thus, in this article, we will introduce a quick means to realize it within seconds.

After reading my previous article “How to Batch Export Multiple Outlook Contact Groups as Word documents”, you may come up with a similar requirement. That is quickly exporting multiple contact groups into a single Word document or PDF file. Hence, thereinafter, we will take a PDF file as an example to teach you how to accomplish it with VBA code.

Quickly Export Multiple Outlook Contact Groups into a PDF File

Quickly Export Multiple Contact Groups into a PDF File

  1. At the very beginning, launch your Outlook program.
  2. Then, press “Alt + F11” key buttons to get into Outlook VBA editor.
  3. Next, copy and paste the following VBA code into an unused module.
Sub ExportMultipleContactGroupsIntoOnePDFFile()
    Dim objSelection As Outlook.Selection
    Dim strTempFolder As String
    Dim objItem As Object
    Dim objContactGroup As Outlook.DistListItem
    Dim strFilePath As String
    Dim objWordApp As Object
    Dim objTempDocument As Object
    Dim i As Long
    Dim strWordDocument As String
    Dim strPDF As String
    'Get selected contact groups
    Set objSelection = Outlook.Application.ActiveExplorer.Selection
    If Not objSelection Is Nothing Then
       strTempFolder = Environ("Temp") & "\" & "TEMP " & Format(Now, "YYYY-MM-DD hh-mm-ss")
       MkDir (strTempFolder)
       For Each objItem In objSelection
           If TypeOf objItem Is DistListItem Then
              Set objContactGroup = objItem
              'Save the contact group as word document
              strFilePath = strTempFolder & "\" & objContactGroup.DLName & ".doc"
              objContactGroup.SaveAs strFilePath, olDoc
           End If
      'Merge all the Word documents into a single document
      Set objWordApp = CreateObject("Word.Application")
      Set objTempDocument = objWordApp.Documents.Add
      strWordDocument = Dir(strTempFolder & "\" & "*.doc")
      i = 0
      Do Until strWordDocument = ""
         i = i + 1
         Set objWordRange = objTempDocument.Range
         With objWordRange
             .Collapse wdCollapseEnd
            If i > 1 Then
             .InsertBreak wdSectionBreakNextPage
             .End = objTempDocument.Range.End
             .Collapse wdCollapseEnd
            End If
             .InsertFile strTempFolder & "\" & strWordDocument
         End With
         strWordDocument = Dir()
      'Change the path to save the PDF file
      strPDF = "E:\Exported Contact Groups.pdf"
      objTempDocument.ExportAsFixedFormat strPDF, wdExportFormatPDF
      objTempDocument.Close False
    End If
End Sub

VBA Code - Export Multiple Contact Groups into a PDF File

  1. After that, you need add this macro to Quick Access Toolbar. As for how, you can refer to the article – “How to Run VBA Code in Your Outlook”.
  2. Subsequently, close the current window.
  3. Eventually, you can take a shot:
  • In the first place, select the source contact groups to be exported.
  • Next, click the macro button in Quick Access Toolbar.Run Macro on Selected Contact Groups
  • After macro completes, you will gain a PDF file in the predefined path.
  • This PDF file will look like the screenshot below:Exported PDF File

Cope with Frequent Outlook Issues

It is known that Outlook is prone to errors and susceptible to corruption though it offers users multiple features. Hence, you had better keep vigilant against all potential risks around your Outlook. For example, you need keep closing Outlook properly, keep Outlook file in small size and block malicious emails and so on. In addition, keeping a potent PST repair utility, such as DataNumen Outlook Repair, handy is a matter of necessity.

Author Introduction:

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

Comments are closed.