Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Klaus Klaus is offline
external usenet poster
 
Posts: 6
Default custom record selection for mailmerge

Here is my problem.
I am creating cards (4 up per page). On the front side i want to print some
information from a word database in the sequence of row 1: record 1, 2 row
2: record 3, 4. However on the back (second run through the printer), I want
to print some more info from the database, but now the record sequence is row
1: record 2, 1 row 2: record 4, 3 and so on.
So now i have to create a formula to print the data in this new sequence.
Any ideas??
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default custom record selection for mailmerge

The following code was put together for someone who wanted to compile a
document by taking alternate pages from separate files. If you were to
execute two separate mail merges to individual documents, you could use this
code to then combine them into one and then duplex print them to get what
you want.

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

"Klaus" wrote in message
...
Here is my problem.
I am creating cards (4 up per page). On the front side i want to print
some
information from a word database in the sequence of row 1: record 1, 2
row
2: record 3, 4. However on the back (second run through the printer), I
want
to print some more info from the database, but now the record sequence is
row
1: record 2, 1 row 2: record 4, 3 and so on.
So now i have to create a formula to print the data in this new sequence.
Any ideas??



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
"Next Record If", Mail Merge Issues [email protected] Mailmerge 8 February 8th 06 07:11 PM
Next Record If, problems with merging multiple records [email protected] Mailmerge 0 January 13th 06 04:38 PM
Record 21 was an empty record Ima Mailmerge 0 September 15th 05 06:16 PM
expanding custom dictionary [email protected] Microsoft Word Help 2 May 24th 05 10:21 PM
Setting custom size problem Bob S Page Layout 0 December 24th 04 03:25 PM


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