2 Ways to Extract All Email Addresses from Your Word Document and Concatenate Them for Batch Processing

In this article, we will introduce you 2 ways to extract all email addresses in a Word document and concatenate them for batch processing.

Now and then, you may have to email to multiple persons at one time. However, things can get a little tricky when their addresses are scattering around a long document in pages. To navigate the whole document and find them one by one can be time-consuming. It is why we want to show you the quick way to extract all of them in one move for batch processing in your mail box.

Method 1: Use “Find and Replace” Option

  1. First and foremost, open the document containing email addresses.
  2. Then we start by clicking “Home” tab.
  3. Next choose to click the upside-down triangle on “Find” icon.
  4. On the drop-down list, choose “Advanced Find”.Click "Home"->Click the Upside-down Button behind "Find"->Click "Advanced Find"
  5. Now you will have the “Find and Replace” dialog box open. Ensure the “Find” tab is on and enter “[A-z,0-9]{1,}\@[A-z,0-9,\.]{1,}” into the “Find what” text box.
  6. Next click “More” to view more options.Type Strings ->Click "More"
  7. Then check “Use wildcards” box under “Search Options”.
  8. Click “Find In” button and select “Main Document”.Check "Use wildcards"->Click "Find In"->Choose "Main Document"
  9. Now you can see all the email addresses in this document have been highlighted. Close the dialog box.
  10. Next click “Copy” in “Clipboard” group under “Home” tab.Click "Home"->Click "Copy"
  11. Now create a new Word document.
  12. Right click on the new one and choose “Keep Text Only”. You shall see all email addresses are pasted there in column.Choose "Keep Text Only"
  13. Then click “Replace” in “Editing” group under “Home” tab.Click "Home"->Click "Replace"
  14. In “Under “Replace” tab, enter “^p” and “;” in “Find what” and “Replace with” text boxes respectively.
  15. And remember to clear the “Use wildcards” box.
  16. Then click “Replace All” button. Word will tell you how many replacements it has made and you can close all open boxes. On the document are email addresses separated by semicolons.Enter in "Find what" and "Replace with" Text Boxes ->Clear "Use wildcards" Box ->Click "Replace All"Email Addresses Separated by Semicolons
  17. What you need do lastly is to copy these addresses to your mail box and send the same information for all the receivers at once.

Method 2: Use VBA Codes

  1. Firstly, press “Alt+F11” to open the VBA editor.
  2. Then on the editing area, paste the following codes:
Sub ExtractAllEmailAddressesFromDocument()
  Dim strEmailAddresses As String    

      ' Find all email addresses in a document,and Extract them.
      With ActiveDocument.Range        
        With.Find
          .ClearFormatting
          .Replacement.ClearFormatting
          .Text = "[A-z,0-9]{1,}\@[A-z,0-9,\.]{1,}"
          .Replacement.Text = ""
          .Forward = True
          .Wrap = wdFindStop
          .Format = False
          .MatchCase = False
          .MatchWholeWord = False
          .MatchByte = False
          .MatchAllWordForms = False
          .MatchSoundsLike = False
          .MatchWildcards = True
          .Execute
      End With   
      Do While .Find.Found
        strEmailAddresses = strEmailAddresses & .Text & ";"
        .Collapse wdCollapseEnd
        .Find.Execute
      Loop
      End With

      '  Open a new document to paste the email addresses.
      If strEmailAddresses <> "" Then
        Documents.Add Template:="Normal", NewTemplate:=False, DocumentType:=0
        ActiveDocument.Range.Text = strEmailAddresses
      End If
End Sub
  1. Next hit “Run” button.Paste Codes ->Hit "Run"

You will then have another new document with all the email addresses there, separated by semicolons. And you can start using them for batch processing in mail box.

Effect of Running VBA Codes

Seize the Time to Retrieve Damaged Files

True, you can always find some surprises through working with Word. While you are amazed by its capabilities, you should watch out for the possible crashes that Word can suffer. On one hand, it stops your work. On the other hand, an even greater threat can prompt when Word collapses. And by greater threat we mean your compromised files and irreplaceable data.

Therefore, we keep suggesting you to make backups and most importantly, getting hold of a program to repair Word damage so you won’t waste time fussing around.

Author Introduction:

Vera Chen is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including xls problem fix tool and pdf repair software products. For more information visit www.datanumen.com

Comments are closed.