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.
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:
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
- In the first place, start your Outlook application.
- Then turn to “Developer” tab.
- Click on the “Visual Basic” button under this tab.
- Next you will get access to the new “Microsoft Visual Basic for Applications” window. And then open a new module.
- 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
- After that, you can exit the current window and add the new macro to Quick Access Toolbar.
- 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.
- Ultimately, a Word document file will display immediately, which will be similar to the following picture:
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.
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