Reply
 
Thread Tools Display Modes
  #1   Report Post  
Frustrated Mail Merger
 
Posts: n/a
Default Mail Merge End of File

I am trying to do a mail merge into two separate tables in the same document.
However, when it gets done merging the first table it of course is at the
end of file. Then when it gets to the second table in the document - it
doesn't merge anything because it's at the end of file. How do I get it to
go back to the beginning of the file before it starts merging into the second
table?
  #2   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Mail Merge End of File

Just how do you have the mergefields arranged in the mailmerge main
document? The data should repeat for each instance of the mergefields in
the 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

"Frustrated Mail Merger" Frustrated Mail
wrote in message ...
I am trying to do a mail merge into two separate tables in the same
document.
However, when it gets done merging the first table it of course is at the
end of file. Then when it gets to the second table in the document - it
doesn't merge anything because it's at the end of file. How do I get it
to
go back to the beginning of the file before it starts merging into the
second
table?



  #3   Report Post  
Frustrated Mail Merger
 
Posts: n/a
Default Mail Merge End of File

The table on page 1 has 7 columns and many rows. I have the fields placed in
the 1st row and then at the beginning of the 2nd row I have Next Record in
the first cell and then the fields placed like row 1. The rest of the rows
are all like row 2 with Next Record in cell 1. Then on page 5 of the same
document I have another table with different information - it has 11 columns
and many rows. Again I have row 1 with the data I want placed and then on
the rest of the rows I have Next Record in cell 1 and the same data placed.
The first table works fine - but it doesn't go back to the beginning of the
file for the table on page 5 (this table is blank).

"Doug Robbins - Word MVP" wrote:

Just how do you have the mergefields arranged in the mailmerge main
document? The data should repeat for each instance of the mergefields in
the 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

"Frustrated Mail Merger" Frustrated Mail
wrote in message ...
I am trying to do a mail merge into two separate tables in the same
document.
However, when it gets done merging the first table it of course is at the
end of file. Then when it gets to the second table in the document - it
doesn't merge anything because it's at the end of file. How do I get it
to
go back to the beginning of the file before it starts merging into the
second
table?




  #4   Report Post  
Doug Robbins - Word MVP
 
Posts: n/a
Default Mail Merge End of File

The only way to handle that will be to use two mailmerge maindocuments and
execute the merges to new documents and then to combine them back into one.
The following macro that was written for a person who wanted to create a
document made up by interleaving the pages from two separate documents,
could be modified to handle the combination of the two mail merge documents.

Dim sourcea As Document, sourceb As Document, target As Document, Pages
As Integer, Counter As Integer, targetrange As Range 'targetrange added

Dim evenpage As Range

Set sourcea = Documents.Open(FileName:="...")

sourcea.Repaginate

Pages = ActiveDocument.BuiltInDocumentProperties(wdPropert yPages)

MsgBox Pages

Set sourceb = Documents.Open(FileName:="...")

Set target = Documents.Add

target.PageSetup.LeftMargin = sourcea.PageSetup.LeftMargin

target.PageSetup.RightMargin = sourcea.PageSetup.RightMargin

target.PageSetup.TopMargin = sourcea.PageSetup.TopMargin

target.PageSetup.BottomMargin = sourcea.PageSetup.BottomMargin

target.AcceptAllRevisions

Counter = 0

While Counter Pages

sourcea.Activate

ActiveDocument.Bookmarks("\page").Range.Copy

Set targetrange = target.Range

targetrange.Start = targetrange.End

targetrange.Paste

ActiveDocument.Bookmarks("\page").Range.Cut

sourceb.Activate 'Assumed to be the document containing the even
pages

Selection.EndKey Unit:=wdStory 'Line of code added to start from the
end of the document

ActiveDocument.Bookmarks("\page").Range.Copy

Set targetrange = target.Range

targetrange.Start = targetrange.End

targetrange.Paste

targetrange.Start = targetrange.End

targetrange.InsertBreak Type:=wdPageBreak

Set evenpage = ActiveDocument.Bookmarks("\page").Range

evenpage.Start = evenpage.Start - 1

evenpage.Delete

Counter = Counter + 1

Wend

sourcea.Close wdDoNotSaveChanges

sourceb.Close wdDoNotSaveChanges

--
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

"Frustrated Mail Merger"
wrote in message ...
The table on page 1 has 7 columns and many rows. I have the fields placed
in
the 1st row and then at the beginning of the 2nd row I have Next Record in
the first cell and then the fields placed like row 1. The rest of the
rows
are all like row 2 with Next Record in cell 1. Then on page 5 of the same
document I have another table with different information - it has 11
columns
and many rows. Again I have row 1 with the data I want placed and then on
the rest of the rows I have Next Record in cell 1 and the same data
placed.
The first table works fine - but it doesn't go back to the beginning of
the
file for the table on page 5 (this table is blank).

"Doug Robbins - Word MVP" wrote:

Just how do you have the mergefields arranged in the mailmerge main
document? The data should repeat for each instance of the mergefields in
the 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

"Frustrated Mail Merger" Frustrated Mail

wrote in message
...
I am trying to do a mail merge into two separate tables in the same
document.
However, when it gets done merging the first table it of course is at
the
end of file. Then when it gets to the second table in the document -
it
doesn't merge anything because it's at the end of file. How do I get
it
to
go back to the beginning of the file before it starts merging into the
second
table?






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
attaching pdf file with main word document in mail merge Yadav Microsoft Word Help 2 August 13th 05 09:55 AM
how to use the mail merge in word with an exel file withdecimals? Danny Gamboa Tables 2 May 12th 05 06:53 PM
Mail Merge with Hanging File tab Inserts 1/5 11137 Krandall Mailmerge 1 April 4th 05 09:36 PM
How to attach a PDF file to a Mail Merge Email from Word? RPMissions Mailmerge 1 January 16th 05 07:06 AM
Mail merge toolbar unavailable after SP3 R Scott Lowden Mailmerge 1 December 1st 04 06:24 PM


All times are GMT +1. The time now is 12:47 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"