Reply
 
Thread Tools Display Modes
  #1   Report Post  
Glenn
 
Posts: n/a
Default Saving Mail Merge Records & also printing them.

I've read the info Doug Robbins has posted on how to save individual mail
merge records.

I have two questions:

1) Is there a way to specify a specific folder you want the document saved
into based on one of the merge fields?

and

2) Is there a way to print the individual documents instead of saving them.
This might seem like an odd question. I know that you can merge to printer.
However, I have a printer that does things such as back to back, folding,
stapling, etc. Whenever I try to send a mail merge document through to it,
it considers all of the individual documents to be one big job. So, if I
have five people in my database who are each receiving a two page letter
from me, and I want the first page to come from tray one because it is
special paper, what happens is that the very first page of the merge will
come from tray one and the rest of the pages will come from the default
tray. I've tried numerous ways of doing this and nothing works.

I suppose that I could save them all as individual files and then select all
and print, but that seems like extra work that could be avoided.

Thanks,
Glenn


  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

With the following method, the path plus the name could be taken from the
datasource:

If you want each file to be named based on one of the fields in the data
source,
here's a method that I have used that involves creating a separate
catalog type mailmerge maindocument which creates a word document containing
a table in each row of which would be your data from the database that you
want to use as the filename.

You first execute that mailmerge, then save that file and close it. Then
execute the mailmerge that you want to create the separate files from and
with the
result of that on the screen, run a macro containing the following code
and when the File open dialog appears, select the file containing the table
created by the first mailmerge

' Throw Away Macro created by Doug Robbins
'
Dim Source As Document, oblist As Document, DocName As Range, DocumentName
As String
Dim i As Long, doctext As Range, target As Document
Set Source = ActiveDocument
With Dialogs(wdDialogFileOpen)
.Show
End With
Set oblist = ActiveDocument
Counter = 1
For i = 1 To oblist.Tables(1).Rows.Count
Set DocName = oblist.Tables(1).Cell(i, 1).Range
DocName.End = DocName.End - 1

'Change the path in the following command to suit where you want to save
the documents.
DocumentName = "I:\WorkArea\Documentum\" & DocName.Text
Set doctext = Source.Sections(i).Range
doctext.End = doctext.End - 1
Set target = Documents.Add
target.Range.FormattedText = doctext
target.SaveAs FileName:=DocumentName
target.Close
Next i

To print each record separately, execute the merge to a new document and
then run the following macro on that document

Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count
.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
Next i
End With





--
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
"Glenn" wrote in message
...
I've read the info Doug Robbins has posted on how to save individual mail
merge records.

I have two questions:

1) Is there a way to specify a specific folder you want the document
saved into based on one of the merge fields?

and

2) Is there a way to print the individual documents instead of saving
them. This might seem like an odd question. I know that you can merge to
printer. However, I have a printer that does things such as back to back,
folding, stapling, etc. Whenever I try to send a mail merge document
through to it, it considers all of the individual documents to be one big
job. So, if I have five people in my database who are each receiving a
two page letter from me, and I want the first page to come from tray one
because it is special paper, what happens is that the very first page of
the merge will come from tray one and the rest of the pages will come from
the default tray. I've tried numerous ways of doing this and nothing
works.

I suppose that I could save them all as individual files and then select
all and print, but that seems like extra work that could be avoided.

Thanks,
Glenn



  #3   Report Post  
Glenn
 
Posts: n/a
Default

Thanks, again.

I haven't tried the first part (saving), but I have tried the second part
(printing).

I tried it for two different documents. The first one worked great.

The second one didn't work so great. It seemed to be printing the document
in pieces. After some investigating, I noticed that my original document
had different sections in it. What happened is that when I ran the macro it
was printing each section for each merge recipient. I'm guessing the "s" in
your code stands for section.

Is there anyway around this? Some of my documents need to have various
sections in them due to headers & footers, etc.

Thanks.


"Doug Robbins" wrote in message
...
With the following method, the path plus the name could be taken from the
datasource:

If you want each file to be named based on one of the fields in the data
source,
here's a method that I have used that involves creating a separate
catalog type mailmerge maindocument which creates a word document

containing
a table in each row of which would be your data from the database that you
want to use as the filename.

You first execute that mailmerge, then save that file and close it. Then
execute the mailmerge that you want to create the separate files from and
with the
result of that on the screen, run a macro containing the following code
and when the File open dialog appears, select the file containing the

table
created by the first mailmerge

' Throw Away Macro created by Doug Robbins
'
Dim Source As Document, oblist As Document, DocName As Range, DocumentName
As String
Dim i As Long, doctext As Range, target As Document
Set Source = ActiveDocument
With Dialogs(wdDialogFileOpen)
.Show
End With
Set oblist = ActiveDocument
Counter = 1
For i = 1 To oblist.Tables(1).Rows.Count
Set DocName = oblist.Tables(1).Cell(i, 1).Range
DocName.End = DocName.End - 1

'Change the path in the following command to suit where you want to

save
the documents.
DocumentName = "I:\WorkArea\Documentum\" & DocName.Text
Set doctext = Source.Sections(i).Range
doctext.End = doctext.End - 1
Set target = Documents.Add
target.Range.FormattedText = doctext
target.SaveAs FileName:=DocumentName
target.Close
Next i

To print each record separately, execute the merge to a new document and
then run the following macro on that document

Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count
.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
Next i
End With





--
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
"Glenn" wrote in message
...
I've read the info Doug Robbins has posted on how to save individual

mail
merge records.

I have two questions:

1) Is there a way to specify a specific folder you want the document
saved into based on one of the merge fields?

and

2) Is there a way to print the individual documents instead of saving
them. This might seem like an odd question. I know that you can merge

to
printer. However, I have a printer that does things such as back to

back,
folding, stapling, etc. Whenever I try to send a mail merge document
through to it, it considers all of the individual documents to be one

big
job. So, if I have five people in my database who are each receiving a
two page letter from me, and I want the first page to come from tray one
because it is special paper, what happens is that the very first page of
the merge will come from tray one and the rest of the pages will come

from
the default tray. I've tried numerous ways of doing this and nothing
works.

I suppose that I could save them all as individual files and then select
all and print, but that seems like extra work that could be avoided.

Thanks,
Glenn





  #4   Report Post  
Doug Robbins
 
Posts: n/a
Default

First off, you need to consider whether they really do need to have more
than one section. Maybe a Different First Page header and footer will
accomplish what you are now doing with separate sections.

If however you cannot avoid having a multi section mailmerge main document,
you would need to modify the macro as follows, where n is the number of
section in the mailmerge main document
Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count, Step n
.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i + n - 1
Next i
End With


--
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
"Glenn" wrote in message
...
Thanks, again.

I haven't tried the first part (saving), but I have tried the second part
(printing).

I tried it for two different documents. The first one worked great.

The second one didn't work so great. It seemed to be printing the
document
in pieces. After some investigating, I noticed that my original document
had different sections in it. What happened is that when I ran the macro
it
was printing each section for each merge recipient. I'm guessing the "s"
in
your code stands for section.

Is there anyway around this? Some of my documents need to have various
sections in them due to headers & footers, etc.

Thanks.


"Doug Robbins" wrote in message
...
With the following method, the path plus the name could be taken from the
datasource:

If you want each file to be named based on one of the fields in the data
source,
here's a method that I have used that involves creating a separate
catalog type mailmerge maindocument which creates a word document

containing
a table in each row of which would be your data from the database that
you
want to use as the filename.

You first execute that mailmerge, then save that file and close it. Then
execute the mailmerge that you want to create the separate files from and
with the
result of that on the screen, run a macro containing the following code
and when the File open dialog appears, select the file containing the

table
created by the first mailmerge

' Throw Away Macro created by Doug Robbins
'
Dim Source As Document, oblist As Document, DocName As Range,
DocumentName
As String
Dim i As Long, doctext As Range, target As Document
Set Source = ActiveDocument
With Dialogs(wdDialogFileOpen)
.Show
End With
Set oblist = ActiveDocument
Counter = 1
For i = 1 To oblist.Tables(1).Rows.Count
Set DocName = oblist.Tables(1).Cell(i, 1).Range
DocName.End = DocName.End - 1

'Change the path in the following command to suit where you want to

save
the documents.
DocumentName = "I:\WorkArea\Documentum\" & DocName.Text
Set doctext = Source.Sections(i).Range
doctext.End = doctext.End - 1
Set target = Documents.Add
target.Range.FormattedText = doctext
target.SaveAs FileName:=DocumentName
target.Close
Next i

To print each record separately, execute the merge to a new document and
then run the following macro on that document

Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count
.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
Next i
End With





--
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
"Glenn" wrote in message
...
I've read the info Doug Robbins has posted on how to save individual

mail
merge records.

I have two questions:

1) Is there a way to specify a specific folder you want the document
saved into based on one of the merge fields?

and

2) Is there a way to print the individual documents instead of saving
them. This might seem like an odd question. I know that you can merge

to
printer. However, I have a printer that does things such as back to

back,
folding, stapling, etc. Whenever I try to send a mail merge document
through to it, it considers all of the individual documents to be one

big
job. So, if I have five people in my database who are each receiving a
two page letter from me, and I want the first page to come from tray
one
because it is special paper, what happens is that the very first page
of
the merge will come from tray one and the rest of the pages will come

from
the default tray. I've tried numerous ways of doing this and nothing
works.

I suppose that I could save them all as individual files and then
select
all and print, but that seems like extra work that could be avoided.

Thanks,
Glenn







  #5   Report Post  
Jasy
 
Posts: n/a
Default

Dear Mr.Douh Robbins
I have tried your throw away macro included in the reply and is working fine
except one problem..
During savng to separate files , the header and footer in the original
document strips out.
The saved file is wthout header and footer.
Any advice.

Thanks
Jasy



"Doug Robbins" wrote in message
...
First off, you need to consider whether they really do need to have more
than one section. Maybe a Different First Page header and footer will
accomplish what you are now doing with separate sections.

If however you cannot avoid having a multi section mailmerge main
document, you would need to modify the macro as follows, where n is the
number of section in the mailmerge main document
Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count, Step n
.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i + n - 1
Next i
End With


--
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
"Glenn" wrote in message
...
Thanks, again.

I haven't tried the first part (saving), but I have tried the second part
(printing).

I tried it for two different documents. The first one worked great.

The second one didn't work so great. It seemed to be printing the
document
in pieces. After some investigating, I noticed that my original document
had different sections in it. What happened is that when I ran the macro
it
was printing each section for each merge recipient. I'm guessing the "s"
in
your code stands for section.

Is there anyway around this? Some of my documents need to have various
sections in them due to headers & footers, etc.

Thanks.


"Doug Robbins" wrote in message
...
With the following method, the path plus the name could be taken from
the
datasource:

If you want each file to be named based on one of the fields in the data
source,
here's a method that I have used that involves creating a separate
catalog type mailmerge maindocument which creates a word document

containing
a table in each row of which would be your data from the database that
you
want to use as the filename.

You first execute that mailmerge, then save that file and close it.
Then
execute the mailmerge that you want to create the separate files from
and
with the
result of that on the screen, run a macro containing the following code
and when the File open dialog appears, select the file containing the

table
created by the first mailmerge

' Throw Away Macro created by Doug Robbins
'
Dim Source As Document, oblist As Document, DocName As Range,
DocumentName
As String
Dim i As Long, doctext As Range, target As Document
Set Source = ActiveDocument
With Dialogs(wdDialogFileOpen)
.Show
End With
Set oblist = ActiveDocument
Counter = 1
For i = 1 To oblist.Tables(1).Rows.Count
Set DocName = oblist.Tables(1).Cell(i, 1).Range
DocName.End = DocName.End - 1

'Change the path in the following command to suit where you want to

save
the documents.
DocumentName = "I:\WorkArea\Documentum\" & DocName.Text
Set doctext = Source.Sections(i).Range
doctext.End = doctext.End - 1
Set target = Documents.Add
target.Range.FormattedText = doctext
target.SaveAs FileName:=DocumentName
target.Close
Next i

To print each record separately, execute the merge to a new document and
then run the following macro on that document

Dim i As Long
With ActiveDocument
For i = 1 To .Sections.Count
.PrintOut Range:=wdPrintFromTo, From:="s" & i, To:="s" & i
Next i
End With





--
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
"Glenn" wrote in message
...
I've read the info Doug Robbins has posted on how to save individual

mail
merge records.

I have two questions:

1) Is there a way to specify a specific folder you want the document
saved into based on one of the merge fields?

and

2) Is there a way to print the individual documents instead of saving
them. This might seem like an odd question. I know that you can merge

to
printer. However, I have a printer that does things such as back to

back,
folding, stapling, etc. Whenever I try to send a mail merge document
through to it, it considers all of the individual documents to be one

big
job. So, if I have five people in my database who are each receiving
a
two page letter from me, and I want the first page to come from tray
one
because it is special paper, what happens is that the very first page
of
the merge will come from tray one and the rest of the pages will come

from
the default tray. I've tried numerous ways of doing this and nothing
works.

I suppose that I could save them all as individual files and then
select
all and print, but that seems like extra work that could be avoided.

Thanks,
Glenn









Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SAVING MAIL MERGE RECORDS Sherry Mailmerge 1 August 8th 05 08:15 PM
skipped mail merge records cls Mailmerge 1 April 28th 05 05:54 PM
mail merge with attachments AS Mailmerge 5 April 9th 05 09:49 AM
How to Mail merge records into a new/separate document Denise Mailmerge 1 February 1st 05 11:25 PM
How do I keep a blank line from printing in a mail merge? Record. Kellye Mailmerge 1 December 8th 04 12:50 AM


All times are GMT +1. The time now is 09:44 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"