A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Mailmerge
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Multiple merge Documents



 
 
Thread Tools Display Modes
  #1  
Old August 24th, 2004, 03:44 PM
Paul
external usenet poster
 
Posts: n/a
Default Multiple merge Documents

Can anyone help me.

I have multiple merge documents that all use the same data source (TAB
delimited txt file)

I have a "Merge Macro.dot" document that I call that runs a macro to
do the mail merge.

It reads a list of the documents that I want to merge

e.g

'Read the list of documents to be merged
Open ("C:\Mydoclist.txt") For Input As #1
Do While Not EOF(1)
Input #1, FileToPrn
'Insert the actual file
Selection.Range.Subdocuments.AddFromFile Name:="C:\"&
FileToPrn, ReadOnly:=True
Loop
Close #1


And then does the mail merge.

ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:="C:\emergdat.txt"
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With

The problem is that is joins all the documents together to make one
long document. I need it wo be separate documents. I.e There will be
multiple windows open in Word.

I don't really know the Word VBA but I can't find anything that would
instruct word to create a new document each time.

Any help would be appreciated

Thanks in Advance
  #2  
Old August 24th, 2004, 04:41 PM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default

Hi Paul,

I'm not clear on what you mean by the "multiple documents" that should
result. Do you mean a separate document for each record you're merging?
Or separate documents containing all the records for each of the "main"
documents you're pulling in using the SubDocument feature?

For the former (pulling apart the resulting records of a merge) there
are various approaches (my website and word.mvps.org). But most of them
base on the fact that a section break is inserted between each new
record. However, since you're using the SubDocument feature, your main
document is already chock full of section breaks...

Assuming that only the mail merge is inserting New Page section breaks,
you could try modifying either of these approaches to test for that type
of section break.

Or, if this is Word 2002/2003 you might want to consider using mail
merge events to change how the result is being processed.

I have multiple merge documents that all use the same data source (TAB
delimited txt file)

I have a "Merge Macro.dot" document that I call that runs a macro to
do the mail merge.

It reads a list of the documents that I want to merge

e.g

'Read the list of documents to be merged
Open ("C:\Mydoclist.txt") For Input As #1
Do While Not EOF(1)
Input #1, FileToPrn
'Insert the actual file
Selection.Range.Subdocuments.AddFromFile Name:="C:\"&
FileToPrn, ReadOnly:=True
Loop
Close #1


And then does the mail merge.

ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:="C:\emergdat.txt"
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=True
End With

The problem is that is joins all the documents together to make one
long document. I need it wo be separate documents. I.e There will be
multiple windows open in Word.

I don't really know the Word VBA but I can't find anything that would
instruct word to create a new document each time.


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

  #3  
Old August 25th, 2004, 07:32 AM
Paul
external usenet poster
 
Posts: n/a
Default

Cindy M -WordMVP- wrote in message news:VA.00009de2.0105d665@speedy...
Hi Paul,

I'm not clear on what you mean by the "multiple documents" that should
result. Do you mean a separate document for each record you're merging?
Or separate documents containing all the records for each of the "main"
documents you're pulling in using the SubDocument feature?

For the former (pulling apart the resulting records of a merge) there
are various approaches (my website and word.mvps.org). But most of them
base on the fact that a section break is inserted between each new
record. However, since you're using the SubDocument feature, your main
document is already chock full of section breaks...

Assuming that only the mail merge is inserting New Page section breaks,
you could try modifying either of these approaches to test for that type
of section break.

Or, if this is Word 2002/2003 you might want to consider using mail
merge events to change how the result is being processed.


Basically I have documents A,B,C...... with merge fields in them. They
all use the same data source because they use the same records but in
different areas of the documents.

So now the client wants to merge documents A and C but they want them
to be separate documents and not one document with these 2 documents
"inserted".

Is using the subdocument command the wrong command to use? Is there
not a way to say "Start each subdocument as a new document"
  #4  
Old August 25th, 2004, 10:33 AM
Cindy M -WordMVP-
external usenet poster
 
Posts: n/a
Default

Hi Paul,

Is using the subdocument command the wrong command to use? Is there
not a way to say "Start each subdocument as a new document"

No, there's not. The Master Document feature was actually designed to bring
things together for printing, not pull them apart :-) Also, a MasterDoc isn't
reknowned for being the most stable construct...

The object model does have a way to open each subdocument in a master
document, then save it as a separate file. You'll find this in the example on
my website for "pulling apart" a mail merge document (separate file for each
record). You can test how well that works on a document resulting from a
mailmerge. I can't see off-hand any reason it would not work, but I've never
tried it, either, so have no idea what effect mail merge might have on the
master document. I do suggest, however, that you choose a CATALOG type merge
to avoid getting any stray section breaks.

I'm not clear on what you mean by the "multiple documents" that should
result. Do you mean a separate document for each record you're merging?
Or separate documents containing all the records for each of the "main"
documents you're pulling in using the SubDocument feature?

For the former (pulling apart the resulting records of a merge) there
are various approaches (my website and word.mvps.org). But most of them
base on the fact that a section break is inserted between each new
record. However, since you're using the SubDocument feature, your main
document is already chock full of section breaks...

Assuming that only the mail merge is inserting New Page section breaks,
you could try modifying either of these approaches to test for that type
of section break.

Or, if this is Word 2002/2003 you might want to consider using mail
merge events to change how the result is being processed.


Basically I have documents A,B,C...... with merge fields in them. They
all use the same data source because they use the same records but in
different areas of the documents.

So now the client wants to merge documents A and C but they want them
to be separate documents and not one document with these 2 documents
"inserted".

Is using the subdocument command the wrong command to use? Is there
not a way to say "Start each subdocument as a new document"


Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Names In A Mail Merge Field Traci New Users 3 June 30th, 2004 03:51 AM
Mail Merge with multiple Receipents in the TO line Rob General Discussion 5 June 25th, 2004 10:25 PM
How to run word and pass a mail merge values and fax it to the recipient Belinda Mailmerge 2 June 13th, 2004 12:49 AM
Updating docproperty value in multiple documents vicki General Discussion 3 June 12th, 2004 04:12 AM


All times are GMT +1. The time now is 10:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.