Word 2010: Mail Merge to Email with Attachments

[Pages:8]Word 2010: Mail Merge to Email with Attachments

Table of Contents

TO SEE THE SECTION FOR MACROS, YOU MUST TURN ON THE DEVELOPER TAB:...............2 SET REFERENCE IN VISUAL BASIC: .........................................................................................................2 CREATE THE MACRO TO USE WITHIN THE MAIL MERGE:.............................................................2 CREATE THE DIRECTORY FOR THE MAIL MERGE USING OUTLOOK CONTACTS: ................4

CREATE THE EMAIL MAIL MERGE AND RUN THE MACRO: ...........................................................................5 CREATE ANOTHER EMAIL MERGE WITH ATTACHMENTS USING AN EXCEL FILE AS THE SOURCE: .............................................................................................................................................................6

CREATE THE MAIL MERGE AND RUN THE MACRO:........................................................................................8 ADD THE MACRO TO A BUTTON ON THE QUICK ACCESS TOOLBAR: .........................................8

Word 2010: Mail Merge to Email with Attachments ICT Training, Maxwell School of Syracuse University

This procedure is credited to Doug Robbins, Microsoft MVP



Page 1

To see the section for Macros, you must turn on the Developer tab: 1) File / Options / Customize Ribbon / check Developer under Customize the Ribbon / OK

Set reference in Visual Basic: 1) Developer tab / Code group / Visual Basic

2) In the Microsoft Visual Basic window, choose Tools / References

3) Scroll to "Microsoft Outlook ## Object Library" / check this option / OK

4) File / Close and Return to Microsoft Word

Create the macro to use within the Mail Merge:

1) Copy the code needed for the macro - to be pasted into the Visual Basic window: a) Go to the following webpage: b) Scroll down and select all of the code from "Sub emailmergewithattachments ()" through "End Sub" at the end of the code / Copy / return to Word

Word 2010: Mail Merge to Email with Attachments ICT Training, Maxwell School of Syracuse University

This procedure is credited to Doug Robbins, Microsoft MVP



Page 2

2) Create the macro in Visual Basic: a) Developer tab / Code group / Macros

Macro name: emailmergewithattachments

Macros in: All active templates and documents

Description: "This macro will complete the mail merge process when creating a mail merge to email with attachments."

b) Paste the code you copied into the Visual Basic Editor: Click the Create button. (1) The Visual Basic application opens. Delete any existing code in the Code window. Paste the code you copied from the web page into the Code window. Close the Visual Basic window.

Word 2010: Mail Merge to Email with Attachments ICT Training, Maxwell School of Syracuse University

This procedure is credited to Doug Robbins, Microsoft MVP



Page 3

Create the Directory for the mail merge using Outlook Contacts:

1) Mailings tab / Start Mail Merge group / Start Mail Merge button / Directory 2) Select the recipients of the mail merge:

This can be any of the usual sources you would use for a mail merge: Outlook Contacts, an Excel spreadsheet, Word table, Access database.

The source you use for this Directory must be the same source you are using for the mail merge.

a) Click the Select Recipients button / Select from Outlook Contacts... In the "Select Contacts" dialog box, make sure the contact folder you wish to use is selected, and then click OK.

In the "Mail Merge Recipients" dialog box you can deselect whomever you do not need to send the mail merge to.

OK 3) Create the Directory document:

a) Insert a 1 x 2 table:

One column will hold the email addresses, and one column will hold the file path for the attachment.

Insert tab / Tables group / Table button / highlight the first two cells in the grid / click the second cell to add a new table.

Insertion point should be in the first cell of the table.

b) Insert the email address merge field: Mailings tab / Write & Insert Fields group / Insert Merge Field / select Email_Address

If the document you want to send in the mail merge is the same for everyone, you can add the path to the file in this document.

If you are sending different documents to your mail merge recipients, you can add that information after merging to a new document.

When you add a path to the file, it must be exact. We will assume that we are sending the same document to everyone for this mail merge.

Word 2010: Mail Merge to Email with Attachments ICT Training, Maxwell School of Syracuse University

This procedure is credited to Doug Robbins, Microsoft MVP



Page 4

c) Add the file path to the second column: Place the insertion point in the second cell / Activate Windows Explorer Open the folder that contains the document(s) you want to attach. Click in the address bar to see the full path / Copy the selection Return to Word / Paste the selection in the second cell Return to Windows Explorer / select the name of the file, including the file extension / Copy the selection Return to Word / type a back slash at the end of the current path / Paste the selection after the slash

d) Finish and Merge the letter to individual documents: Mailings tab / Finish group / Finish & Merge button / select Edit Individual Documents... In the "Merge to New Document dialog box", choose All / OK

A new document is created with the list of email addresses and the path to the file.

e) Save the new document:

Make sure you remember where you have this document stored ? you will be prompted for it when the macro runs.

Save As / Name your file / Save Close the Directory file / close the mail merge document without saving.

Create the Email Mail Merge and run the macro: 1) Create a New document / Mailings tab / Start Mail Merge group / Start mail Merge button / Letters

a) Select Recipients button / Select from Outlook Contacts... / OK at the "Select Contacts" dialog box.

At the Mail Merge Recipients you can pick and choose who to send the mail merge to.

b) Select your recipients / OK 2) Write the letter, inserting mail merge fields, as needed.

This is a typical mail merge ? only the ending process has changed.

3) Finish and Merge the letter to individual documents: a) Mailings tab / Finish group / Finish and Merge button / Edit Individual Documents... / All / OK

Word 2010: Mail Merge to Email with Attachments ICT Training, Maxwell School of Syracuse University

This procedure is credited to Doug Robbins, Microsoft MVP



Page 5

4) Run the macro: a) Developer tab / Code group / Macros button / select the "emailmergewithattachments" macro / Run

If the macro delivers an error and brings you back to the Visual Basic window: Cancel the window Developer tab / Code group / Visual Basic button / Tools / References ? make sure "Microsoft Outlook ## Object Library" is selected / OK Close the Visual Basic window. Rerun the macro.

b) Word takes you to the Open dialog box ? navigate to the Directory document / select the file and click Open.

c) Enter a subject for the email message / OK

A message is returned indicating the number of emails that were sent. If you need to keep a copy of the document, save it, otherwise, close all documents without saving.

Create another email merge with attachments using an Excel file as the source:

The macro has already been created. Once it's created, you can use it over and over. Remember that the source for your Directory must be the same as the source for your Mail Merge

recipients.

1) Create a new Directory: a) Create a New Document / Mailings tab / Start Mail Merge group / Start Mail Merge button / Directory b) Select the recipients of the mail merge:

Remember - the source you use for this Directory must be the same source you are using for the mail merge.

Click the Select Recipients button / Use Existing List... (1) In the "Select Data Source" window, navigate to the Excel file / select the file / Open (2) In the Select Table dialog box, choose the worksheet that contains your contact information / OK

If needed, click the Edit Recipient List button / select only the recipients for the mail merge / OK

Word 2010: Mail Merge to Email with Attachments ICT Training, Maxwell School of Syracuse University

This procedure is credited to Doug Robbins, Microsoft MVP



Page 6

2) Create the Directory document:

a) Insert a 1 x 2 table:

Insert tab / Tables group / Table button / highlight the first two cells in the grid / click the second cell to add a new table.

Insertion point should be in the first cell of the table.

b) Insert the email address merge field:

Mailings tab / Write & Insert Fields group / Insert Merge Field / insert the email address field

Note ? if your fieldnames do not appear, you must match them to the fieldnames that Word recognizes. Use the "Match Fields" button on the Ribbon.

If the document you want to send in the mail merge is the same for everyone, you can add the path to the file in this document.

If you are sending different documents to your mail merge recipients, you can add that information after merging to a new document.

When you add a path to the file, it must be exact.

We will send different documents to the recipients this time.

c) Finish and Merge the letter to individual documents:

Leave the second column blank ? we will fill this in after sending to individual letters.

Mailings tab / Finish group / Finish & Merge button / select Edit Individual Documents...

In the "Merge to New Document dialog box", choose All / OK

d) Add the file paths to the second column:

Place the insertion point in the second cell of the first row / activate Windows Explorer

Open the folder that contains the document(s) you want to attach.

Click in the address bar to see the full path / Copy the selection

Return to Word / Paste the selection in the second cell

Return to Windows Explorer / select the name of the file, including the file extension / Copy the selection

Return to Word / type a back slash at the end of the current path / Paste the selection after the slash

Continue this process, using the different file paths for each recipient.

e) Save the new Directory document:

Make sure you remember where you have this document stored ? you will be prompted for it when the macro runs.

Save As / Name the Directory / Save

Close the Directory file / close the mail merge document without saving.

Word 2010: Mail Merge to Email with Attachments ICT Training, Maxwell School of Syracuse University

This procedure is credited to Doug Robbins, Microsoft MVP



Page 7

Create the Mail Merge and run the macro:

1) Create a New document / Mailings tab / Start Mail Merge group / Start mail Merge button / Letters a) Select Recipients button / Use an Existing List... / In the "Select Data Source" window, navigate to the Excel source file / select the file / Open In the Select Table dialog box, choose the worksheet that contains your contact information / OK b) If necessary, click Edit Recipient List / select only the recipients of the mail merge / OK.

2) Write the letter, inserting mail merge fields, as needed. 3) Finish and Merge the letter to individual documents:

a) Mailings tab / Finish group / Finish and Merge button / Edit Individual Documents... / All / OK 4) Run the macro:

a) Developer tab / Code group / Macros button / select the "emailmergewithattachments" macro / Run b) Word takes you to the Open dialog box ? navigate to the Directory document / select the file /

Open. c) Enter a subject for the email message / OK

A message is returned indicating the number of emails that were sent.

Add the macro to a button on the Quick Access Toolbar:

1) Click the Customize Quick Access Toolbar button / More Commands... a) Choose commands from: = Macros b) Select your macro name / Add c) Click Modify at the bottom of the second column / choose a picture for the button / change the Display name: "Email merge with Attachments", for example / OK / OK

2) When you are ready to complete the mail merge process, click the macro button to run the code.

Word 2010: Mail Merge to Email with Attachments ICT Training, Maxwell School of Syracuse University

This procedure is credited to Doug Robbins, Microsoft MVP



Page 8

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download