Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / December 2006

Tip: Looking for answers? Try searching our database.

Using the same mailmerge criteia for 2 different documents...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruce - 21 Dec 2006 16:56 GMT
Since Word mailmerge does not have the capability to do anything like a
"previous rec" after doing several nextrec when working with mailmerge, I am
trying to do the next best thing (and maybe even better!)

First, what I am trying to accomplish, and then you might even see something
easier that I can think of....

I have an excel spreadsheet that I use for my notary business. I create a
row for each clients transactions (there may be several entries for each
signing-this is what is causing the greif) that I witness for loan
signing(s) for. This worksheet has all the contact and billing info for
everybody  for that signing (loan office, title co, escrow company etc) as
well as directions, all the dates that are important for the signing, the
fee I charge etc...

I created 1 document that has two pages that are created from the info in
the worksheet when I go to the clients home. One is "Signing Info"and the
other is "Invoice". Each of these sheets by themselves work fine. The
problem is that if I need to process several rows of info using NEXTREC in
the first sheet, then the second sheet will not be able to process the info
that was on the row I moved from. This is all understandable, no bugs or
anything.

What I _THINK_ I really need to do, is to split these into 2 separate docs
(created by 2 seperate DOTs) and then use them that way.

Now, here is what I am trying to figure out. How can I create both
documents, using the same info, as smoothly and automatically as possible? I
would ideally like to do this by running one macro.

Thanks,
Bruce
Peter Jamieson - 21 Dec 2006 18:53 GMT
Not sure that this will really help but the starting point is that Word does
not really do "one-to many" relationships. If possible, use something that
is, such as Access reports. But if you need to
use Word, you may find the following articles useful:

http://homepage.swissonline.ch/cindymeister/mergfaq1.htm#DBPic

http://support.microsoft.com/default.aspx?scid=kb;en-us;211303

http://www.knowhow.com/Guides/CompoundMerges/CompoundMerge.htm

Peter Jamieson

> Since Word mailmerge does not have the capability to do anything like a
> "previous rec" after doing several nextrec when working with mailmerge, I
[quoted text clipped - 28 lines]
> Thanks,
> Bruce
Bruce - 21 Dec 2006 23:30 GMT
This is a flat file. This is not a relationship issue. These are just
seperate entries of data when several are selected.  ( I could use a
relationship, but then I would NOT be able to use word. )

These are not even using a pivot table. Just a selection of multiple rows of
data.

Thanks
Bruce

> Not sure that this will really help but the starting point is that Word
> does not really do "one-to many" relationships. If possible, use something
[quoted text clipped - 41 lines]
>> Thanks,
>> Bruce
Peter Jamieson - 22 Dec 2006 02:24 GMT
OK, maybe something like

Sub DoubleMerge()

' Untested macro code...

Dim objMMMD1 As Word.Document
Dim objMMOD1 As Word.Document
Dim objMMMD2 As Word.Document
Dim objMMOD2 As Word.Document
Dim rngMMOD1 As Word.Range

' Open and merge document 1
Set objMMMD1 = Documents.Open(FileName:="mergedoc1.doc")

' Assume the merge data source is already set up
With objMMMD1.MailMerge
 .Destination = wdSendToNewDocument
 With .DataSource
   .FirstRecord = wdDefaultFirstRecord
   .LastRecord = wdDefaultLastRecord
 End With
 .Execute
End With

' The Activedocument is now the output document (unless there were errors
and a separate error output)

Set objMMOD1 = ActiveDocument
objMMMD1.Close SaveChanges:=False
Set objMMMD1 = Nothing

' Open and merge document 2

Set objMMMD2 = Documents.Open(FileName:="mergedoc2.doc")

' Assume the merge data source is already set up
With objMMMD2.MailMerge
 .Destination = wdSendToNewDocument
 With .DataSource
   .FirstRecord = wdDefaultFirstRecord
   .LastRecord = wdDefaultLastRecord
 End With
 .Execute
End With

' The Activedocument is now the output document (unless there were errors
and a separate error output)

Set objMMOD2 = ActiveDocument
objMMOD2.Content.Copy
Set rngMMOD1 = objMMOD1.Content
rngMMOD1.Collapse Direction:=wdCollapseEnd
rngMMOD1.Paste
objMMOD1.SaveAs FileName:="myname.doc"
objMMOD1.Close SaveChanges:=False
objMMOD2.Close SaveChanges:=False
Set objMMOD1 = Nothing
Set objMMOD2 = Nothing
Set rngMMOD1 = Nothing
End Sub

You may need to add/remove paragraphs around the inserted chunk (cf.

http://word.mvps.org/faqs/macrosvba/GetRngToEndOfInsertFile.htm

). You'll probably be better off putting any headers and footers in one of
the documents, and ensuring that your two documents don't use the same
paragraph/character style names in tow different ways.

Peter Jamieson

> This is a flat file. This is not a relationship issue. These are just
> seperate entries of data when several are selected.  ( I could use a
[quoted text clipped - 51 lines]
>>> Thanks,
>>> Bruce
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.