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
 
P

Peter R. Fletcher

I have been bitten by something like this.

Try telling Word _not_ to Prnt in the background (the first parameter
for .PrintOut, which you are currently setting to True, should be
False to disable background printing). My symptoms were slightly
different, but the problem was that the instance of Word was being
closed before it had spooled my document to the printer. Like you, I
was using Doc.Close False to prevent "do you want to save this file
first" prompts, but this also prevents the warning that you normally
get when you try to close Word when it is printing.

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

Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
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.
 
P

Peter R. Fletcher

That's worth knowing. I assume that the property is accessible from
the Automation interface. If you look in Help while editing VBA code
behind a Word Document, you should be able to find out what it is
called.

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.

Please respond to the Newsgroup, so that others may benefit from the exchange.
Peter R. Fletcher
 
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