How to Quickly Export the Selected Contacts’ Information to a Word Document with Outlook VBA

Sometimes, you may need to export several selected contacts’ information to a Word document. This article will teach you how to easily and quickly get it via Outlook VBA.

Outlook provides you with a direct feature to export Outlook items to CSV, Excel or Access file, shown as the following screenshot. But there is no “Export to Word” feature available.

Export to a File

Perhaps you will think of using “Save As” feature. But when you select several contacts and then go to “File” > “Save As”, in the “Save As” dialog box, you will not find Doc file types alike, either, like the image below:No Doc File Type Option in Save As

Therefore, if you would like to extract the selected contacts’ main information to Word, you have to utilize other means, such as Outlook VBA. Here are detailed steps and elaborate codes.

Export the Selected Contacts’ Information to a Word Document

  1. In the first place, start your Outlook application.
  2. Then turn to “Developer” tab.
  3. Click on the “Visual Basic” button under this tab.
  4. Next you will get access to the new “Microsoft Visual Basic for Applications” window. And then open a new module.
  5. Subsequently, you can copy and paste the following VBA codes into it.
Sub ExportSelectedContactInfotoWord()
    Dim objSelection As Outlook.Selection
    Dim objContact As Outlook.ContactItem
    Dim strContactInfo As String
    Dim objWordApp As Word.Application
    Dim objDocument As Word.Document
    Dim objTable As Word.Table
    Dim objRange As Word.Range
 
    Set objSelection = Outlook.Application.ActiveExplorer.Selection
 
    'Create a new Word document file
    Set objWordApp = CreateObject("Word.Application")
    Set objDocument = objWordApp.Documents.Add
    objDocument.Activate
    Set objRange = objDocument.Range(0, 0)
 
    'Extract the selected contacts' main information
    For Each objContact In objSelection
        If objContact.Class = olContact Then
           strContactInfo = "Name: " & objContact.FullName & vbCrLf & "Email: " & objContact.Email1Address & vbCrLf & "Company: " & objContact.Companies & vbCrLf & "Business Phone: " & objContact.Business2TelephoneNumber & vbCrLf & "Business Address: " & objContact.BusinessAddress & vbCrLf & "-----------------------------------------------------------" & vbCrLf & strContactInfo
        End If
    Next
 
    'Add the information to the Word document file
    objRange.Text = strContactInfo
 
    'Display the document file
    objWordApp.Visible = True
    objDocument.ActiveWindow.Visible = True
End Sub

VBA Codes - Export the Selected Contacts’ Information to a Word Document

  1. After that, you can exit the current window and add the new macro to Quick Access Toolbar.
  2. Eventually, you can have a try:
  • Firstly, select the contacts which you would like to export to a Word document.
  • Then click the macro button in the Quick Access Toolbar.Run the New Macro in QAT
  • Ultimately, a Word document file will display immediately, which will be similar to the following picture:New Word Document for the Selected Contacts' Information

Keep Mindful of Potential Risks around Your Outlook

Since Outlook is the same vulnerable as other software, it is an arduous task for you to safeguard your Outlook data. Therefore, in order to provide the immediate rescue after Outlook damage, you should keep a robust repair tool in vicinity, like DataNumen Outlook Repair.

Author Introduction:

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

Comments are closed.