I have an Access 97 file that I am trying to link to Word 97. So the user can hit a button in access form that will open Word and merge current record data. Then the user can save and print the merged document. I have approx 35 fields that will be linked.
I have downloaded numerous code examples and can't seem to make it work. Here is my code:
Private Sub cmdWord_Click()
On Error GoTo Err_cmdWord_Click
Dim oApp As Object
Dim trf As Object
Set oApp = CreateObject("Word.Application"
oApp.Visible = True
oApp.Documents.Open "i:\swap\mergetest"
Set trf = oApp.ActiveDocument
With trf
.Item("Subject"
.Value = (Me![Subject])
End With
Exit_cmdWord_Click:
Exit Sub
It opens Word and my document by then says "Object doesn't support this property or method" and closes Word back to Access. Any ideas?
(I tried the GetObject rather than CreateObject (Thread 701-52131) and it would not work maybe 97 to 2000 difference?
Also is this the best way to merge data from access to Word?
My end result document is approx 20 pages and has the same 35 fields throughout.
Since I have never done this before I was wondering is this slow? Am I prone to get error messages? Other comments?
I have downloaded numerous code examples and can't seem to make it work. Here is my code:
Private Sub cmdWord_Click()
On Error GoTo Err_cmdWord_Click
Dim oApp As Object
Dim trf As Object
Set oApp = CreateObject("Word.Application"
oApp.Visible = True
oApp.Documents.Open "i:\swap\mergetest"
Set trf = oApp.ActiveDocument
With trf
.Item("Subject"
End With
Exit_cmdWord_Click:
Exit Sub
It opens Word and my document by then says "Object doesn't support this property or method" and closes Word back to Access. Any ideas?
(I tried the GetObject rather than CreateObject (Thread 701-52131) and it would not work maybe 97 to 2000 difference?
Also is this the best way to merge data from access to Word?
My end result document is approx 20 pages and has the same 35 fields throughout.
Since I have never done this before I was wondering is this slow? Am I prone to get error messages? Other comments?