OPERATING SYSTEMSOS Windows

How to extract Email Addresses from Word document


Here is a tutorial to extract all email addresses from Word documents in Windows 11/10. If you have Word documents (DOC, DOCX) with multiple email addresses and you want to use those email addresses for any purpose, it will be really tiring to manually search for them. An easier solution for you is to extract all email addresses from the document and then use them as you want. Now, to extract email addresses from Word documents, you don’t need any third-party solution. In this article, I am going to show two simple tricks to extract email addresses from Word documents. You can do so in the Microsoft Word application. Let us check out the methods now!

How to extract Email Addresses from Word document

Here are the two methods to extract all email addresses from a Word document in Windows 11/10:

  1. Extract email addresses using the Advanced Find option in MS Word.
  2. Use VBA code to extract all email addresses from a Word document.

Let us talk about these methods in detail!

1] Extract email addresses using the Advanced Find option in MS Word

You can use the Advanced Find/ Find and replace option in Microsoft Word to extract all email addresses from Word documents. Here are the main steps to do so:

  1. Launch Microsoft Word.
  2. Open a Word document containing email addresses.
  3. Go to the Find > Advanced Find option.
  4. Enter a string in the Find what field.
  5. Enable the Use wildcards checkbox.
  6. Click on the Find In > Main Document button.
  7. Return to the main document and use the Copy option.
  8. Create a new blank document and paste copied email addresses.

Now, let’s elaborate on these steps now!

Firstly, run the Microsoft Word application on your PC and then import a Word document that contains the email addresses that you want to extract.

Now, in the Home tab, go to the Editing section and click on the Find drop-down button. Then, tap on the Advanced Find option. This will open up a Find and Replace dialog box.

How to extract Email Addresses from Word document

In the Find and Replace dialog box, from the Find tab, enter the [A-z,0-9]{1,}@[A-z,0-9,.]{1,} string in the Find what field.

After that, press the More button which will open up various options.

Next, enable the Use wildcards checkbox.

Then, click on the Find In drop-down button and select the Main Document option.

As you do that, all the mail addresses will be highlighted and selected in the source Word document, as shown in the below screenshot.

Now what you have to do is that click on the Copy button present in the Home tab. Alternately, you can also use copy hotkey i.e., Ctrl +C shortcut key. It will copy all the email addresses present in the Word document to the clipboard.

Next, create a blank Word document or open the Notepad app and simply paste the copied email addresses using the dedicated option or Ctrl + V hotkey.

How to Extract Email Addresses from Word document in Windows 11/10

You can now save the document with extracted email addresses from the Word document and use the email addresses however you want.

2] Use VBA code to extract all email addresses from a Word document

You can also use a simple Visual Basic for Applications (VBA) code in order to extract all email addresses from Word documents. Here are the main steps to do so:

  1. Open the Word app and then import the source document.
  2. Launch VBA Editor.
  3. Insert a new module.
  4. Enter the VBA code for email address extraction.
  5. Run the VBA code to extract all email addresses.

First, open the Word app and then import the input Word document from which you want to extract all email addresses.

Now, launch the VBA Editor using the Alt + F11 key combination. If you have enabled the Developers tab on the main ribbon, you can go to the Developer tab and click on the Visual Basic option to open up the VBA Editor.

Next, in the VBA Editor window, go to the Insert menu and click on the Module option.

After that, in the right section, enter the below VBA code in the editor window:

Sub ExtractAllEmailAddressesFromDocument()
Dim strEmailAddresses As String

' Extract all email addresses in a document.
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

Then, go to the Run menu and click on the Run Macros option or simply the F5 key. A Macros dialog window will open up where you need to select the created macro and then click the Run button.

As you click on the Run button, a new Word document will open up with all the extracted email addresses from the Word document.

You can simply save the document with extracted email addresses and use them as required.

As Microsoft Word supports a variety of document formats, these email address extraction methods can be used for a non-Word document too, such as XML, ODT, etc.

Now read: Extract email addresses using Easy Email Extractor.

How to extract Email Addresses from Word document

Source link

Alice AUSTIN

Alice AUSTIN is studying Cisco Systems Engineering. He has passion with both hardware and software and writes articles and reviews for many IT websites.

Leave a Reply

Your email address will not be published. Required fields are marked *