How to Quickly Send an Outlook Email to All Email Addresses Occurring in Several Word Documents

If you want to quickly extract all the email addresses from several Word documents and send an Outlook email to these email addresses, you had better use the method shared in this article. It is much quicker than manually performing.

Quickly Send an Outlook Email to All Email Addresses Occurring in Several Word Documents

At times, you may hold several important Word documents, which contain many email addresses scattering around the documents. In this case, if you would like to send an Outlook email to these email addresses, in general, you may select to manually copy the email addresses to the email recipient line. However, without any doubts, it is too tedious. Thus, here we will expose a piece of VBA code, which can achieve this task within seconds.

Send an Email to All Email Addresses Occurring in Several Word documents

  1. At the very outset, you should store all the source Word documents in a same Windows folder.
  2. Then you could start your Outlook application as normal.
  3. Next in the main Outlook window, you need to press “Alt + F11” key buttons.
  4. Subsequently, you’ll get access to the “Microsoft Visual Basic for Applications” window.
  5. Now, you can open a new module and copy the VBA code below into it.
Sub SendEmailto_AllEmailAddresses_inSeveralWordDocuments()
    Dim objShell As Object
    Dim objLocalFolder As Object
    Dim strLocalFolder As String
    Dim strFile As String
    Dim strWordDocument As String
    Dim objMail As Outlook.MailItem
    Dim objMailDocument As Word.Document
    Dim objWordApp As Word.Application
    Dim objWordDocument As Word.Document
    'Select the local folder which contains the source Word documents
    Set objShell = CreateObject("Shell.Application")
    Set objLocalFolder = objShell.BrowseForFolder(0, "Select the folder which contains the source Word documents:", 0, "")
    If Not objLocalFolder Is Nothing Then
       strLocalFolder = objLocalFolder.self.Path & "\"
       strFile = Dir(strLocalFolder)
       'Create a new Outlook email
       Set objMail = Application.CreateItem(olMailItem)
       Set objMailDocument = objMail.GetInspector.WordEditor
       Set objWordApp = CreateObject("Word.Application")
       objWordApp.Visible = True
       Do Until strFile = ""
          'Work on the Word documents in this local folder
          If Right(strFile, 4) = ".doc" Or Right(strFile, 5) = ".docx" Then
             strWordDocument = strFile
             Set objWordDocument = objWordApp.Documents.Open(strLocalFolder & strWordDocument)
             'Find the email addresses via wildcards
             With objWordApp.Selection.Find
                  .Text = "[A-z,0-9]{1,}\@[A-z,0-9,.]{1,}"
                  .MatchWildcards = True
             End With
             While objWordApp.Selection.Find.Found
                   'Add the email addresses as recipients
                   objMail.Recipients.Add (objMail.Body)
                   objMail.Body = ""
             'Close the Word document
         End If
         'Skip to the next file in this folder
         strFile = Dir
       'Exit Word Application
    End If
End Sub

VBA Code - Send an Outlook Email to All Email Addresses Occurring in Several Word Documents

  1. After that, you need to check Outlook macro settings, insuring the macros are enabled.
  2. Ultimately, you could take a shot by following the steps below:
  • In the first place, back to the new macro window.
  • Then press F5 key to start this macro.
  • Next you’d be required to select a source Windows folder.Select a source Windows folder
  • After that, the macro will begin to extract all the email addresses in the Word documents and add them as recipients in a new Outlook email.
  • This mail will look like the screenshot below:Email Addresses Inserted as Recipients

Essential Precautions before Outlook Corruption

Although Outlook contains myriad features, it has no function to avoid errors or corruption effectively. Therefore, you should keep cautious during using Outlook, such as exiting Outlook properly, preventing malicious emails and so on. Plus, it’s suggested to keep a formidable and reliable Outlook repair tool, like DataNumen Outlook Repair. It can assist you to restore corrupted Outlook data like a breeze.

Author Introduction:

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

Comments are closed.