Reply
 
Thread Tools Display Modes
  #1   Report Post  
John
 
Posts: n/a
Default Save Parts of Large Mailmerge as Separate Files

I have a very large list that that I want to email different parts of to
different departments. I'd like to save each department's letters into
a separate file as part of the merge process. The question
is how can I merge the document and have part of the merge saved to a
new file each time the department name changes? Ideally, I would like
the file name to be based on the department name.

I've done work with macros similar to this before, but it's been years
and I'm a bit rusty. Thanks for any advice.
  #2   Report Post  
Graham Mayor
 
Posts: n/a
Default

You appear to have asked this in a number of Word neswgroups at least two of
which have received replies.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




John wrote:
I have a very large list that that I want to email different parts of
to different departments. I'd like to save each department's letters
into a separate file as part of the merge process. The question
is how can I merge the document and have part of the merge saved to a
new file each time the department name changes? Ideally, I would like
the file name to be based on the department name.

I've done work with macros similar to this before, but it's been years
and I'm a bit rusty. Thanks for any advice.



  #3   Report Post  
Jezebel
 
Posts: n/a
Default

Run separate merges, one for each department, using the department name as
part of the query WHERE clause. Save each into a separate file.

You could automate the whole process if you really need to, but unless you
have a large number of departments or you're going to be doing this
repeatedly, it's probably not worth the trouble.




"John" wrote in message
...
I have a very large list that that I want to email different parts of to
different departments. I'd like to save each department's letters into
a separate file as part of the merge process. The question
is how can I merge the document and have part of the merge saved to a
new file each time the department name changes? Ideally, I would like
the file name to be based on the department name.

I've done work with macros similar to this before, but it's been years
and I'm a bit rusty. Thanks for any advice.



  #4   Report Post  
John
 
Posts: n/a
Default

The problem is that I'm going to have about 2,000 pages (one per
employee)split over 125+ departments, so I really didn't want to run
each separately - I was really looking to automate the process.

Jezebel wrote:
Run separate merges, one for each department, using the department name as
part of the query WHERE clause. Save each into a separate file.

You could automate the whole process if you really need to, but unless you
have a large number of departments or you're going to be doing this
repeatedly, it's probably not worth the trouble.




"John" wrote in message
...

I have a very large list that that I want to email different parts of to
different departments. I'd like to save each department's letters into
a separate file as part of the merge process. The question
is how can I merge the document and have part of the merge saved to a
new file each time the department name changes? Ideally, I would like
the file name to be based on the department name.

I've done work with macros similar to this before, but it's been years
and I'm a bit rusty. Thanks for any advice.




  #5   Report Post  
John
 
Posts: n/a
Default

Thanks

Doug Robbins wrote:
The code in the macro provided below if for an entirely different purpose,
but if you have the datasource ordered by Department, and you create a
catalog type mailmerge with the department mergefield in a single cell table
and execute that merge, then merge the letters to a new file, you could
modify the macro so that it iterates through the catalog merge document to
determine the number of records for each department , then grab that number
of Sections from the formletter merge document and same them to a file with
the name of the department and then repeat that process for each department:

Dim source As Document, target As Document, scat As Range, tcat As Range
Dim data As Range, stab As Table, ttab As Table
Dim i As Long, j As Long, k As Long, n As Long
Set source = ActiveDocument
Set target = Documents.Add
Set stab = source.Tables(1)
k = stab.Columns.Count
Set ttab = target.Tables.Add(Range:=Selection.Range, numrows:=1,
numcolumns:=k - 1)
Set scat = stab.Cell(1, 1).Range
scat.End = scat.End - 1
ttab.Cell(1, 1).Range = scat
j = ttab.Rows.Count
For i = 1 To stab.Rows.Count
Set tcat = ttab.Cell(j, 1).Range
tcat.End = tcat.End - 1
Set scat = stab.Cell(i, 1).Range
scat.End = scat.End - 1
If scat tcat Then
ttab.Rows.Add
j = ttab.Rows.Count
ttab.Cell(j, 1).Range = scat
ttab.Cell(j, 1).Range.Paragraphs(1).PageBreakBefore = True
ttab.Rows.Add
ttab.Cell(j + 1, 1).Range.Paragraphs(1).PageBreakBefore = False
For n = 2 To k
Set data = stab.Cell(i, n).Range
data.End = data.End - 1
ttab.Cell(ttab.Rows.Count, n - 1).Range = data
Next n
Else
ttab.Rows.Add
For n = 2 To k
Set data = stab.Cell(i, n).Range
data.End = data.End - 1
ttab.Cell(ttab.Rows.Count, n - 1).Range = data
Next n
End If
Next i


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
Can you save individual document pages as seperate word files? John Calligy Mailmerge 2 April 12th 05 09:14 AM
Save Parts of Large Mailmerge as Separate Files John Microsoft Word Help 2 January 16th 05 07:07 AM
Merge groups in large list to separate files BlueWomabt Microsoft Word Help 2 January 16th 05 04:55 AM
Merge groups in large list to separate files BlueWomabt Mailmerge 1 January 16th 05 12:17 AM
Save As...*.txt files Scribe Microsoft Word Help 2 December 13th 04 04:45 AM


All times are GMT +1. The time now is 01:03 PM.

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"