Split a mail merge document into individual documents

L

leedelee

How do I take a mail merge document and then split it up into individual
documents to save each letter in a separate place?
 
S

Shelly Faye

Thank you for your "splitmergeletter" macro - it really helps - except for
one thing - formatting is coorect when I merge to new doc - it changes the
font only when I execute your macro??!!

Why?

The original letter is in Arial, the resulting letters are in Arial, the
split letters are in Times New Roman - and as there is a specific look on the
page - eg letterhead also in Arial, we want to preserve the original look.

Thank you for your help.
 
D

Doug Robbins - Word MVP

In place of the

Documents.Add

command in the macro, use

Documents.Add Template:="C:\Program Files\Microsoft Office" _
& "\Templates\Memos\Professional Memo.dot"replacing 'C:\Program
Files\Microsoft Office" _
& "\Templates\Memos\Professional Memo.dot"

With the name of the template used to create the mail merge main document.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Shelly Faye

Thank you for your help.

Doug Robbins - Word MVP said:
In place of the

Documents.Add

command in the macro, use

Documents.Add Template:="C:\Program Files\Microsoft Office" _
& "\Templates\Memos\Professional Memo.dot"replacing 'C:\Program
Files\Microsoft Office" _
& "\Templates\Memos\Professional Memo.dot"

With the name of the template used to create the mail merge main document.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
S

Shelly Faye

I've hit another glitch - everything works great - the font is behaving
properly, the file names that are being saved are perfect - only one problem
- after running the SplitMergeLetter macro, no matter what I do to the bottom
of the merge letter original, the created file has a printing blank page at
the end, with only a paragraph symbol on it.

At the very end of my original merge document, there is only one paragraph
mark that cannot be removed, and the large document that results from the
merge has no blank pages, only a section break after the last character on
each page, only after I split the letters does the blank page show up.

Can anyone help?
 
D

Doug Robbins - Word MVP

Using this macro should overcome that problem:

Sub splitter()
' splitter Macro
' Macro created by Doug Robbins to save each letter created by a mailmerge
' as a separate file, retaining the header and footer information.
Dim i As Long, Source As Document, Target As Document, Letter As Range
Set Source = ActiveDocument
For i = 1 To Source.Sections.Count
Set Letter = Source.Sections(i).Range
Set Target = Documents.Add
Target.Range = Letter
Target.Sections(2).PageSetup.SectionStart = wdSectionContinuous
Target.SaveAs FileName:="Letter" & i
Target.Close
Next i
End Sub

It changes the section break at the end of each letter to a continuous
section break.
--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
R

Richard M 2006

Hello Doug,
Where do I go to open and edit the macro to change the command. Tools,
macro, macros lets me see your macro, but the edit button is greyed out OR
the error says the project cannot be viewed.
Thanks,
Richard
 
D

Doug Robbins - Word MVP

I assume that you are talking about the addin downloaded from Graham's site.
With Word not running, move the file from the Word Startup folder into your
Templates folder and then use File>Open in Word to open that file. After
modifying it, you will then need to save it and move it back into the
Startup folder and restart Word.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
A

aelewis

Is it possible to split a merge document that has several section breaks
within one letter? For example, each individual letter has 2 - 5 section
breaks and then the Section Break (Next Page) ends that letter and begins the
next one.
 
D

Doug Robbins - Word MVP

Yes with the proviso that while the number of sections may vary from mail
merge main document to mail merge main document, there would need to be a
constant number of sections for the one mail merge main document. That is,
if by the use of an If...then...Else construction in the mailmerge main
document you were inserting section breaks, then it would not be possible,
or at least would be very difficult to do it via mail merge - A
"roll-your-own" VBA equivalent to Mail Merge would be a better way of
handling that situation.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
A

aelewis

Thank you for the information! This document is using If...then...Else
statements to insert the breaks.
 
K

Kirstin

I was so happy when I found this macro of Grahams. It sounds like it will do
exactly what I need. Unfortuantely, when I run it I get the following error:

Run-time error 4608: Value out of range.

I'm exporting a dbase file from Access 03. In the query I've added the
Folder/File Name field:

Folder: "\\cee-data\conference forms\" & [GradYear] & "\" & [FirstLast] &
"\" & [Enter Year]

The macro runs; I tell it to split and then I get the error. I click OK on
the error window and a single merged document opens. What could be wrong?
Is it because I have spaces in my folder names? The file names in the sample
have spaces, but maybe that doesn't translate to folder names.

Any help would be most appreciated.

TIA~
 
D

Doug Robbins - Word MVP

What is typically displayed by the Folder: "\\cee-data\conference forms\" &
[GradYear] & "\" & [FirstLast] &
"\" & [Enter Year] field in your query?

If you create a macro containing the code

FileSaveAs "what is displayed in as asked above"

and run it with any document active (a blank one will do), does it save the
document correctly or do you get the same error message.

I think that the \\ may be causing a problem.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Kirstin said:
I was so happy when I found this macro of Grahams. It sounds like it will
do
exactly what I need. Unfortuantely, when I run it I get the following
error:

Run-time error 4608: Value out of range.

I'm exporting a dbase file from Access 03. In the query I've added the
Folder/File Name field:

Folder: "\\cee-data\conference forms\" & [GradYear] & "\" & [FirstLast] &
"\" & [Enter Year]

The macro runs; I tell it to split and then I get the error. I click OK
on
the error window and a single merged document opens. What could be wrong?
Is it because I have spaces in my folder names? The file names in the
sample
have spaces, but maybe that doesn't translate to folder names.

Any help would be most appreciated.

TIA~
--
Kirstin McDonald
ITC


Graham Mayor said:
See http://www.gmayor.com/individual_merge_letters.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
K

Kirstin

I've tried multiple formats:

\\cee-data\share\conference forms\2010\Kate Adams\2007 Narrative
S:\conference forms\2010\Kate Adams\2007 Narrative
\conference forms\2010\Kate Adams\2007 Narrative
conference forms\2010\Kate Adams\2007 Narrative

I've tried creating a new merge doc without using the individual folder
option and still get the error message. I'm stumped and running out of time.

--
Kirstin McDonald
ITC


Doug Robbins - Word MVP said:
What is typically displayed by the Folder: "\\cee-data\conference forms\" &
[GradYear] & "\" & [FirstLast] &
"\" & [Enter Year] field in your query?

If you create a macro containing the code

FileSaveAs "what is displayed in as asked above"

and run it with any document active (a blank one will do), does it save the
document correctly or do you get the same error message.

I think that the \\ may be causing a problem.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Kirstin said:
I was so happy when I found this macro of Grahams. It sounds like it will
do
exactly what I need. Unfortuantely, when I run it I get the following
error:

Run-time error 4608: Value out of range.

I'm exporting a dbase file from Access 03. In the query I've added the
Folder/File Name field:

Folder: "\\cee-data\conference forms\" & [GradYear] & "\" & [FirstLast] &
"\" & [Enter Year]

The macro runs; I tell it to split and then I get the error. I click OK
on
the error window and a single merged document opens. What could be wrong?
Is it because I have spaces in my folder names? The file names in the
sample
have spaces, but maybe that doesn't translate to folder names.

Any help would be most appreciated.

TIA~
--
Kirstin McDonald
ITC


Graham Mayor said:
See http://www.gmayor.com/individual_merge_letters.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



leedelee wrote:
How do I take a mail merge document and then split it up into
individual documents to save each letter in a separate place?
 
D

Doug Robbins - Word MVP

If you are getting an error message when you are not trying to create
individual documents, then the problem would appear to be with something
else.

If you want to send me the mail merge main document and the data source, I
will create the letters for you and send them back.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Kirstin said:
I've tried multiple formats:

\\cee-data\share\conference forms\2010\Kate Adams\2007 Narrative
S:\conference forms\2010\Kate Adams\2007 Narrative
\conference forms\2010\Kate Adams\2007 Narrative
conference forms\2010\Kate Adams\2007 Narrative

I've tried creating a new merge doc without using the individual folder
option and still get the error message. I'm stumped and running out of
time.

--
Kirstin McDonald
ITC


Doug Robbins - Word MVP said:
What is typically displayed by the Folder: "\\cee-data\conference forms\"
&
[GradYear] & "\" & [FirstLast] &
"\" & [Enter Year] field in your query?

If you create a macro containing the code

FileSaveAs "what is displayed in as asked above"

and run it with any document active (a blank one will do), does it save
the
document correctly or do you get the same error message.

I think that the \\ may be causing a problem.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Kirstin said:
I was so happy when I found this macro of Grahams. It sounds like it
will
do
exactly what I need. Unfortuantely, when I run it I get the following
error:

Run-time error 4608: Value out of range.

I'm exporting a dbase file from Access 03. In the query I've added the
Folder/File Name field:

Folder: "\\cee-data\conference forms\" & [GradYear] & "\" & [FirstLast]
&
"\" & [Enter Year]

The macro runs; I tell it to split and then I get the error. I click
OK
on
the error window and a single merged document opens. What could be
wrong?
Is it because I have spaces in my folder names? The file names in the
sample
have spaces, but maybe that doesn't translate to folder names.

Any help would be most appreciated.

TIA~
--
Kirstin McDonald
ITC


:

See http://www.gmayor.com/individual_merge_letters.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



leedelee wrote:
How do I take a mail merge document and then split it up into
individual documents to save each letter in a separate place?
 
K

Kirstin

Hi Doug,

Thank you for offering to take a look. I'll email the two files under
seperate cover.
--
Kirstin McDonald
ITC


Doug Robbins - Word MVP said:
If you are getting an error message when you are not trying to create
individual documents, then the problem would appear to be with something
else.

If you want to send me the mail merge main document and the data source, I
will create the letters for you and send them back.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Kirstin said:
I've tried multiple formats:

\\cee-data\share\conference forms\2010\Kate Adams\2007 Narrative
S:\conference forms\2010\Kate Adams\2007 Narrative
\conference forms\2010\Kate Adams\2007 Narrative
conference forms\2010\Kate Adams\2007 Narrative

I've tried creating a new merge doc without using the individual folder
option and still get the error message. I'm stumped and running out of
time.

--
Kirstin McDonald
ITC


Doug Robbins - Word MVP said:
What is typically displayed by the Folder: "\\cee-data\conference forms\"
&
[GradYear] & "\" & [FirstLast] &
"\" & [Enter Year] field in your query?

If you create a macro containing the code

FileSaveAs "what is displayed in as asked above"

and run it with any document active (a blank one will do), does it save
the
document correctly or do you get the same error message.

I think that the \\ may be causing a problem.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

I was so happy when I found this macro of Grahams. It sounds like it
will
do
exactly what I need. Unfortuantely, when I run it I get the following
error:

Run-time error 4608: Value out of range.

I'm exporting a dbase file from Access 03. In the query I've added the
Folder/File Name field:

Folder: "\\cee-data\conference forms\" & [GradYear] & "\" & [FirstLast]
&
"\" & [Enter Year]

The macro runs; I tell it to split and then I get the error. I click
OK
on
the error window and a single merged document opens. What could be
wrong?
Is it because I have spaces in my folder names? The file names in the
sample
have spaces, but maybe that doesn't translate to folder names.

Any help would be most appreciated.

TIA~
--
Kirstin McDonald
ITC


:

See http://www.gmayor.com/individual_merge_letters.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



leedelee wrote:
How do I take a mail merge document and then split it up into
individual documents to save each letter in a separate place?
 
K

Kirstin

Doug took a look at my template and found that I had somehow created
sections. He deleted them and now everything works like a charm! Thanks so
much, Doug, for taking the time. Really appreciate it!!!!
--
Kirstin McDonald
ITC


Kirstin said:
Hi Doug,

Thank you for offering to take a look. I'll email the two files under
seperate cover.
--
Kirstin McDonald
ITC


Doug Robbins - Word MVP said:
If you are getting an error message when you are not trying to create
individual documents, then the problem would appear to be with something
else.

If you want to send me the mail merge main document and the data source, I
will create the letters for you and send them back.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

Kirstin said:
I've tried multiple formats:

\\cee-data\share\conference forms\2010\Kate Adams\2007 Narrative
S:\conference forms\2010\Kate Adams\2007 Narrative
\conference forms\2010\Kate Adams\2007 Narrative
conference forms\2010\Kate Adams\2007 Narrative

I've tried creating a new merge doc without using the individual folder
option and still get the error message. I'm stumped and running out of
time.

--
Kirstin McDonald
ITC


:

What is typically displayed by the Folder: "\\cee-data\conference forms\"
&
[GradYear] & "\" & [FirstLast] &
"\" & [Enter Year] field in your query?

If you create a macro containing the code

FileSaveAs "what is displayed in as asked above"

and run it with any document active (a blank one will do), does it save
the
document correctly or do you get the same error message.

I think that the \\ may be causing a problem.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

I was so happy when I found this macro of Grahams. It sounds like it
will
do
exactly what I need. Unfortuantely, when I run it I get the following
error:

Run-time error 4608: Value out of range.

I'm exporting a dbase file from Access 03. In the query I've added the
Folder/File Name field:

Folder: "\\cee-data\conference forms\" & [GradYear] & "\" & [FirstLast]
&
"\" & [Enter Year]

The macro runs; I tell it to split and then I get the error. I click
OK
on
the error window and a single merged document opens. What could be
wrong?
Is it because I have spaces in my folder names? The file names in the
sample
have spaces, but maybe that doesn't translate to folder names.

Any help would be most appreciated.

TIA~
--
Kirstin McDonald
ITC


:

See http://www.gmayor.com/individual_merge_letters.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



leedelee wrote:
How do I take a mail merge document and then split it up into
individual documents to save each letter in a separate place?
 
N

non-techie solutions

There is actually a much easier route you can go that uploading an add-in.
See simple instructions below. You just need to replace the section breaks
with page breaks and viola!

1) Go to Find/Replace
2) Click on More
3) Click “Specialâ€
4) Find “Section Breakâ€
5) Replace with “Manual page break†and click ok

Now you’ll be able to save/print whichever pages you want.


Kirstin said:
Doug took a look at my template and found that I had somehow created
sections. He deleted them and now everything works like a charm! Thanks so
much, Doug, for taking the time. Really appreciate it!!!!
--
Kirstin McDonald
ITC


Kirstin said:
Hi Doug,

Thank you for offering to take a look. I'll email the two files under
seperate cover.
--
Kirstin McDonald
ITC


Doug Robbins - Word MVP said:
If you are getting an error message when you are not trying to create
individual documents, then the problem would appear to be with something
else.

If you want to send me the mail merge main document and the data source, I
will create the letters for you and send them back.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

I've tried multiple formats:

\\cee-data\share\conference forms\2010\Kate Adams\2007 Narrative
S:\conference forms\2010\Kate Adams\2007 Narrative
\conference forms\2010\Kate Adams\2007 Narrative
conference forms\2010\Kate Adams\2007 Narrative

I've tried creating a new merge doc without using the individual folder
option and still get the error message. I'm stumped and running out of
time.

--
Kirstin McDonald
ITC


:

What is typically displayed by the Folder: "\\cee-data\conference forms\"
&
[GradYear] & "\" & [FirstLast] &
"\" & [Enter Year] field in your query?

If you create a macro containing the code

FileSaveAs "what is displayed in as asked above"

and run it with any document active (a blank one will do), does it save
the
document correctly or do you get the same error message.

I think that the \\ may be causing a problem.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

I was so happy when I found this macro of Grahams. It sounds like it
will
do
exactly what I need. Unfortuantely, when I run it I get the following
error:

Run-time error 4608: Value out of range.

I'm exporting a dbase file from Access 03. In the query I've added the
Folder/File Name field:

Folder: "\\cee-data\conference forms\" & [GradYear] & "\" & [FirstLast]
&
"\" & [Enter Year]

The macro runs; I tell it to split and then I get the error. I click
OK
on
the error window and a single merged document opens. What could be
wrong?
Is it because I have spaces in my folder names? The file names in the
sample
have spaces, but maybe that doesn't translate to folder names.

Any help would be most appreciated.

TIA~
--
Kirstin McDonald
ITC


:

See http://www.gmayor.com/individual_merge_letters.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



leedelee wrote:
How do I take a mail merge document and then split it up into
individual documents to save each letter in a separate place?
 
D

Doug Robbins - Word MVP

To print individual documents, you do not even have to do that, just specify
the Sections of the document that you want to print in the File Print
dialog.

However, that is NOT a solution to what was originally desired, which was to
create a separate document for each record in the data source.

Sometimes non-techie solutions just don't cut it.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

non-techie solutions said:
There is actually a much easier route you can go that uploading an add-in.
See simple instructions below. You just need to replace the section breaks
with page breaks and viola!

1) Go to Find/Replace
2) Click on More
3) Click "Special"
4) Find "Section Break"
5) Replace with "Manual page break" and click ok

Now you'll be able to save/print whichever pages you want.


Kirstin said:
Doug took a look at my template and found that I had somehow created
sections. He deleted them and now everything works like a charm! Thanks
so
much, Doug, for taking the time. Really appreciate it!!!!
--
Kirstin McDonald
ITC


Kirstin said:
Hi Doug,

Thank you for offering to take a look. I'll email the two files under
seperate cover.
--
Kirstin McDonald
ITC


:

If you are getting an error message when you are not trying to create
individual documents, then the problem would appear to be with
something
else.

If you want to send me the mail merge main document and the data
source, I
will create the letters for you and send them back.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

I've tried multiple formats:

\\cee-data\share\conference forms\2010\Kate Adams\2007 Narrative
S:\conference forms\2010\Kate Adams\2007 Narrative
\conference forms\2010\Kate Adams\2007 Narrative
conference forms\2010\Kate Adams\2007 Narrative

I've tried creating a new merge doc without using the individual
folder
option and still get the error message. I'm stumped and running out
of
time.

--
Kirstin McDonald
ITC


:

What is typically displayed by the Folder: "\\cee-data\conference
forms\"
&
[GradYear] & "\" & [FirstLast] &
"\" & [Enter Year] field in your query?

If you create a macro containing the code

FileSaveAs "what is displayed in as asked above"

and run it with any document active (a blank one will do), does it
save
the
document correctly or do you get the same error message.

I think that the \\ may be causing a problem.



--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of
my
services on a paid consulting basis.

Doug Robbins - Word MVP

I was so happy when I found this macro of Grahams. It sounds
like it
will
do
exactly what I need. Unfortuantely, when I run it I get the
following
error:

Run-time error 4608: Value out of range.

I'm exporting a dbase file from Access 03. In the query I've
added the
Folder/File Name field:

Folder: "\\cee-data\conference forms\" & [GradYear] & "\" &
[FirstLast]
&
"\" & [Enter Year]

The macro runs; I tell it to split and then I get the error. I
click
OK
on
the error window and a single merged document opens. What could
be
wrong?
Is it because I have spaces in my folder names? The file names
in the
sample
have spaces, but maybe that doesn't translate to folder names.

Any help would be most appreciated.

TIA~
--
Kirstin McDonald
ITC


:

See http://www.gmayor.com/individual_merge_letters.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>



leedelee wrote:
How do I take a mail merge document and then split it up into
individual documents to save each letter in a separate place?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top