I'd like to generate a letter (word document), by using formfields and replacing their values with data found in an access table. This works fine. The only thing left: I would like to generate multiple letters (based on the same template) into a single word document. So that if I open the document, I can print all the letters.
This is (a part of) the code I'm using:
Remedy
This is (a part of) the code I'm using:
Code:
Set loWordApp = CreateObject("Word.Application")
loWordApp.Documents.Add "C:\template.dot"
(...)
With loWordApp.ActiveDocument
While Not loRS.EOF
For i = 0 To loRS.Fields.Count - 1
On Error Resume Next
.FormFields(loRS.Fields(i).Name).Result = "" & loRS.Fields(i)
On Error GoTo 0
Next
loRS.MoveNext
Wend
End With
Remedy