VBA to open Word and run mail merge on currently open spreadsheet

Jadelyn

New Member
Joined
Jun 17, 2015
Messages
11
SUMMARY: I've got a sheet of data that I need to have exported to Word via a mail merge, and this specific task happens regularly enough that I want to automate it, especially for other, not particularly tech-savvy, people who have to do this from time to time when I'm not available. Is there a way to use VBA to open a mail merge template from a specified location and then run the merge based on the currently-open spreadsheet?

Context and details:
I run the peer feedback surveys at my company, which is a series of either 6 or 9 competencies (depending on role) that you rate the person on, and optionally provide comments on each as well. I have a macro that I wrote to clean up the data that I get out of SurveyMonkey, part of which splits the comments out from the numerical ratings and puts them on their own worksheet.

The resulting comments worksheet has a first column for the name of the respondent (or Anon if they chose not to put their name), then the next 6-9 columns are headed with the competency names, and each row consists of one respondent's name and then their comments in each area. Some people have comments in all columns, some don't have comments at all but they still get their own row, and some leave comments in one area but not another, so there's an unpredictable number of blank cells in the mix.

Senior management has asked if there's a way to export the peer feedback comments to a word document, arranged by competency, with each respondent's name and comment on that area if there was one. So it would look like:

Comments for Sandra S
Standards of Excellence
  • Eric T: [blah blah blah]
  • Anon: [blah blah blah]
Teamwork and Collaboration
  • Anon: [blah blah blah]
  • Rosa K: [blah blah blah]
  • Anon: [blah blah blah]
Communication
  • Eric T: [blah blah blah]
  • Rosa K: [blah blah blah]
  • Anon: [blah blah blah]

and so on. If I rearrange the comments sheet so that the rows are the competencies, and the columns are Topic, Name1, Comment1, Name2, Comment2, etc. I can use mail merge to get what they're asking for. And I can probably get the VBA to reformat the comments into that layout worked out on my own. I think.

What I'm hoping to find out, though, is if there's a way to use VBA to open a mail merge template document from a specified folder and run the merge based on the currently open spreadsheet? I'm looking to minimize the number of active steps required, since there are people other than me who have to take this process over when I'm not available, and not all of those people are particularly tech-savvy. The less complicated I can make this, the better.

Thanks!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top