woodchuckwood
Registered User.
- Local time
- Today, 19:02
- Joined
- Jan 15, 2004
- Messages
- 10
Help: Simple code fix or OLE Automation?
i'm trying to merge reports into one word document. here is the code:
On Error Resume Next
Dim db As DAO.Database, doc As Document, con As Container
Set db = CurrentDb()
Set con = db.Containers("Reports")
For Each doc In con.Documents
'DoCmd.OutputTo acOutputReport, doc.Name, "RichTextFormat(*.rtf)", "C:\test\" & doc.Name & ".doc", False, ""
DoCmd.OutputTo acOutputReport, doc.Name, "RichTextFormat(*.rtf)", "C:\test\Doc1" & ".doc", False, ""
Debug.Print doc.Name
Next
i altered the DoCmd to dump the rtf files into the Word document "Doc1." after i execute the code processes and starts dumping the first report into Doc1. When the second report generates, it replaces the first and so forth. what do i need to add to the code so that it adds the reports to Doc1 instead of replacing them?
Do i need to create an OLE automation?
A Macro in Word maybe?
i'm trying to merge reports into one word document. here is the code:
On Error Resume Next
Dim db As DAO.Database, doc As Document, con As Container
Set db = CurrentDb()
Set con = db.Containers("Reports")
For Each doc In con.Documents
'DoCmd.OutputTo acOutputReport, doc.Name, "RichTextFormat(*.rtf)", "C:\test\" & doc.Name & ".doc", False, ""
DoCmd.OutputTo acOutputReport, doc.Name, "RichTextFormat(*.rtf)", "C:\test\Doc1" & ".doc", False, ""
Debug.Print doc.Name
Next
i altered the DoCmd to dump the rtf files into the Word document "Doc1." after i execute the code processes and starts dumping the first report into Doc1. When the second report generates, it replaces the first and so forth. what do i need to add to the code so that it adds the reports to Doc1 instead of replacing them?
Do i need to create an OLE automation?
A Macro in Word maybe?