#  Other Applications & Softwares  > Word Formatting & General >  >  Macro to split mail merge into separate documents (MAC)

## baobei

Hi all,
I am an absolute beginners at macros, to the extent where I had to google how to install them, let alone run them!

I am using Mac 2011, and want to be able to split the results of a mail merge document into separate documents (one per record), hopefully renaming the new documents using one of the fields from the excel database.  At this stage I'm not sure if I need the final document to be a docx or pdf, but docx will do to begin with!

I've found lots of code to show how to do this in the windows versions, but they don't appear to work on my mac program.

Can anyone help me, or direct me to somewhere I can find more information?  Thanks!

----------


## macropod

See: http://answers.microsoft.com/en-us/m...5fd9808?auth=1

----------


## baobei

Thanks for the reply  :Smilie:   I've tried that code, but it didn't seem to work.

I am a complete beginner at macros, but this is what I did, based on instructions I found online:

Go to Tools > Macro > Macros...
Type the name of the new macro to be added (in this case "SaveOneDocumentPerDataRecord") and then the Create button
Paste the code from the linked page into the window that opens (which is in Normal - Modules - NewMacros), ensuring that the sub/end sub lines aren't doubled up.

After saving this, I went back to my document, and ran the macro (Tools > Macro > Macros... SaveOneDocumentPerDataRecord, then Run).  It seems to do something (the mail merge manager sort of blinked), but doesn't seem to have created new files or the like.  The only thing that I can see is different is that step 6 of the mail merge manager (complete merge) has changed from "all records" to "custom 1 to 1" instead.

I did notice that the macro was talking about a word data source (i have been using an excel spreadsheet), so I created a new word datasource, but that didn't seem to make a difference.

Any suggestions on how to troubleshoot gratefully accepted!  Maybe I should try posting on the thread you linked to?

----------


## macropod

Given that the code in the link is specifically for Macs, the problem is likely related to your implementation. For example, the code in the macro constructs the output filename from two DataFields, one named 'K' and one named 't'. Naturally, you'd need to change those names to match the field names in your datasource.

There is also no need to create a new word datasource - the macro is designed to work with whatever your existing data source is (i.e. your Excel workbook).

----------


## baobei

Thank you so much!  That was the tip I needed, I've changed the K and t to reflect fields in my database and it's working a treat!  Thanks again for your (super quick) help  :Smilie:

----------


## macropod

You're welcome.

----------

