Print Word Documents From Access

T

Tony C

Good Afternoon

For this problem, I am using MS Office 2000 Professional.

I am trying to print Word Documents from MS Access. The
problem is that although the document prints, the Text
Form Fields within the document, and the content within
the Text Form Fields, are not being printed, can anybody
please offer any advice?

The code that I'm using is as follows, please note that
the code does work as it is detailed below: -

Private Sub PrintReport_Click()
DoCmd.RepaintObject
If FileToPrint = "" Then
MsgValue = MsgBox("There is no SFI to be printed at
this time", vbOKCancel + vbInformation)
Exit Sub
End If
Set AppWord = New Word.Application
Set Doc = AppWord.Documents.Open(FileToPrint)
Doc.PrintOut True, , , , , , wdPrintDocumentContent, , ,
wdPrintAllPages, , , FileToPrint
Doc.Close False
Set Doc = Nothing
Set AppWord = Nothing
MsgValue = MsgBox("SFI Printed", vbOKCancel +
vbInformation)
End Sub

TIA


Tony C
 
T

Tony C

Hello Peter

Thanks for this, but it did not solve the problem..
However I have finally stumbled upon then problem!!

Ms Word can be configured to automatically update fields
prior to printing, setting this property to false solves
the problem. I just need to figure out how to do this
programically for other users.

Tony C.
 
T

Tony C

Hello Again

Here's the updated code: -

Private Sub PrintReport_Click()
DoCmd.RepaintObject
If FileToPrint = "" Then
MsgValue = MsgBox("There is no SFI to be printed at
this time", vbOKCancel + vbInformation)
Exit Sub
End If
Set AppWord = New Word.Application
Set Doc = AppWord.Documents.Open(FileToPrint)
'DISABLES UPDATE FIELDS OPTION IN WORD
AppWord.Options.UpdateFieldsAtPrint = False
Doc.PrintOut False, False, , , , , , , , ,
wdPrintAllPages, True
'Doc.PrintOut Range:=wdPrintAllPages
'ENABLES UPDATE FIELDS OPTION IN WORD
AppWord.Options.UpdateFieldsAtPrint = True
Doc.Close False
Set Doc = Nothing
Set AppWord = Nothing
MsgValue = MsgBox("SFI Printed", vbOKCancel +
vbInformation)
End Sub

Tony C
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top