VBA Saving Word MailMerge files as date & unique identifier based on excel cell value

happyfeet09

New Member
Joined
Aug 10, 2012
Messages
1
Hello,

I'm new to and not well-versed in VBA, but have been working my way towards an automatic mailmerge. The last step which I can't seem to figure out or find an answer for is to save the mail-merged files with part of the saved name being drawn from a specified cell in excel, basically the name of that person for whom the mail merge document was created.

I have done the following for the mail merging portion, and have it working (and I realize I probably have pretty clunky code - of course cleaning it up would be helpful, which, as time permits, I will attempt to do):

1. From excel a macro opens the word mailmerge after creating a cleaned-up excel sheet from which to work, and also creates folders with the individuals' names (where I want to save the mailmerge files).

2. In Word, the documents are created successfully (upon opening the document) and I can save them individually. However, I want that to be done automatically.

Basically, I need to know how (in Word) to define a variable as a certain cell in the excel sheet that is the data source for the mail merge, and then for each record after the first, to go down the same column (e.g. record 1 - the first mail merge document - takes from cell B2 and saves with the contents fo B2 in the file name, 2 from cell B3, 3 from cell B4, etc.).

All help is appreciated. Thanks!

 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,216,099
Messages
6,128,822
Members
449,469
Latest member
Kingwi11y

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