Some users would like to send contacts as text files. Yet, Outlook doesn’t offer such a native feature. Thus, in this article, we will expose a piece of VBA code, which is able to attach multiple contacts as plain text files to an email.
By default, Outlook only permits users to send contacts as vCard files or Outlook items. However, many users would like to send contacts as text files. Therefore, it is necessary to seek other solutions, say the following way. It is using VBA code, which is easy and convenient.
Attach Multiple Contacts as Plain Text Files to a New Email
- At the very outset, start your Outlook program.
- Then, access Outlook VBA editor by “Alt + F11” key buttons.
- Subsequently, put the following VBA code into a project or module.
Sub AttachMultipleContacts_AsTXTFiles() Dim objSelection As Outlook.Selection Dim objNewMail As Outlook.MailItem Dim objItem As Object Dim objContact As Outlook.ContactItem Dim strTempFolder As String Dim strTXTFile As String 'Create a temp folder strTempFolder = Environ("Temp") & "\" & Format(Now, "YYYYMMDDhhmmss") MkDir (strTempFolder) 'Save all selected contacts as text files Set objSelection = Outlook.Application.ActiveExplorer.Selection If Not (objSelection Is Nothing) Then For Each objItem In objSelection If TypeOf objItem Is ContactItem Then Set objContact = objItem objContact.SaveAs strTempFolder & "\" & objContact.FullName & ".txt", olTXT End If Next End If 'Create a new email Set objNewMail = Application.CreateItem(olMailItem) objNewMail.Display 'Attach the TXT files strTXTFile = Dir(strTempFolder & "\") Do While Len(strTXTFile) > 0 objNewMail.Attachments.Add (strTempFolder & "\" & strTXTFile) strTXTFile = Dir Loop End Sub
- After that, you can close the current window.
- Later, according to the article – “How to Run VBA Code in Your Outlook”, you can add the new macro to Quick Access Toolbar.
- Finally, try this macro right now.
- First off, select the source contacts you want to send.
- Then, click the macro button in Quick Access Toolbar, like the screenshot below:
- Immediately, a new mail will display, which is attached with the contacts in .TXT format.
Get Hold of an Outlook Repair Tool
Since Outlook is prone to errors and corruption, you should make a regular data backup for your Outlook PST file. Otherwise, if your Outlook file gets corrupt, you will be required to attempt difficult Outlook recovery. At that point, you ought to take aid of a powerful and experienced fix tool, like DataNumen Outlook Repair. It has shouldered over most of its rivals due to its high recovery rate and fast speed.
Author Introduction:
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including fix sql and outlook repair software products. For more information visit www.datanumen.com
Leave a Reply