Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Merge to separate doc problem

Status
Not open for further replies.

LievenV

MIS
Dec 3, 2002
40
0
0
GB
Hi,

I use the following code to merge excel data into seperate word (2000)documents.

Sub SaveEachDocument()
Application.DisplayAlerts = False
x = "C:\Data\test\"
With ActiveDocument.MailMerge.DataSource
.ActiveRecord = 1
Do Until .ActiveRecord = previousrecord
previousrecord = .ActiveRecord
.ActiveRecord = wdNextRecord
ActiveDocument.SaveAs x & .ActiveRecord & ".doc"
Loop
End With
ActiveDocument.Close
Application.DisplayAlerts = True
End Sub


This produces the documents but the merge fields are still in there. I want the merge fields to be replaced by the actual data like it does when you do a normal merge to a new document.
Anyone any ideas?

Thanks!
 
Why not do the merge, and THEN separate into documents? I do not think you are going to get the current data unless you do the merge.

Gerry
 
Thanks for your reply Gerry.
That would also be good, only I don't see how to do this in VBA. We're talking a few hundred doc's.
Each document has 2 pages.
Can you point me in the right direction?
 
First of all this is a VBA question, not an office question. You should post into the VBA forum.

If you join VBAExpress (free) there is a KnowledgeBase article (under Word) to do exactly this.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top