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