Hi, using code found on-line I'm trying to print a word document in a report.
I get a run time error #424 saying "object required". My document prints
well though. What I would like to do is instead of hard coding the location
as in C:\Wordtest.doc, can the file location be taken from a field from the
query the report is based on? I've tried using the field name but don't know
the syntax.
Appreciate any help,
JIM
Private Sub Report_Open(Cancel As Integer)
PrintDoc() = True
End Sub
Function PrintDoc()
Dim WordObj As Object
Set WordObj = CreateObject("Word.Application")
WordObj.Documents.Open "C:Wordtest.doc"
WordObj.PrintOut Background:=False
WordObj.Quit
Set WordObj = Nothing
End Function
JIM - 20 Mar 2008 18:04 GMT
I'll repost and try another route.
JIM
> Hi, using code found on-line I'm trying to print a word document in a report.
> I get a run time error #424 saying "object required". My document prints
[quoted text clipped - 16 lines]
> Set WordObj = Nothing
> End Function