Merging Access 2007 data into Word 2007 merge file

JWinter95

New member
Local time
Today, 00:58
Joined
May 23, 2011
Messages
1
I want to open several Word documents that have already been connected to a table in Access. I want to have a button that will open the files, merge the data, then close the original files (without saving them) and let the user edit and save the merged data document.

I'm new to the 2007 world - All the coding I've done before was for 2003.

Here's what I have so far...

- - - - - - - - - -
Private Sub Create_AJW()
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Dim strDocPath As String
Dim strConnection As String
Dim wdoc1 As String
Dim wdoc2 As String
Dim wdoc3 As String
Dim wdoc4 As String
Dim wdoc5 As String
Dim wdoc6 As String
Dim wdoc7 As String
Dim wdoc8 As String
Dim wdoc9 As String

Set wordApp = New Word.Application

strDocPath = "X:\Intake\"
wdoc1 = "AJWLTC.docx"
wdoc2 = "AJWLCC.docx"
wdoc3 = "AJWLPA.docx"
wdoc4 = "AJWLCL.docx"
wdoc5 = "000CAP.docx"
wdoc6 = "000FFS.docx"
wdoc7 = "000ENV.docx"
wdoc8 = "000LBL.docx"
wdoc9 = "Alerts.docx"

With wordApp
.Visible = True
Set wodDoc = .Documents.Open(strDocPath & wdoc1)
Set wordDoc = .Documents.Open(strDocPath & wdoc2)
Set wordDoc = .Documents.Open(strDocPath & wdoc3)
Set wordDoc = .Documents.Open(strDocPath & wdoc4)
Set wordDoc = .Documents.Open(strDocPath & wdoc5)
Set wordDoc = .Documents.Open(strDocPath & wdoc6)
Set wordDoc = .Documents.Open(strDocPath & wdoc7)
Set wordDoc = .Documents.Open(strDocPath & wdoc8)
Set wordDoc = .Documents.Open(strDocPath & wdoc8)
Set wordDoc = .Documents.Open(strDocPath & wdoc9)
End With
End Sub
- - - - - - - - - -
The code will open the Word docs, but they no longer have their data source!

Any help/direction would be greatly appreciated.
 

Users who are viewing this thread

Back
Top Bottom