[AccessD] word automation not printing

S D accessd667 at yahoo.com
Tue Mar 2 07:20:46 CST 2004


you could try a timer event...wait a couple of seconds before quiting...
Isn't it possible to use a doevents thingy? 
 
HTH
Sander

"John W. Colby" <jwcolby at colbyconsulting.com> wrote:
Folks,

I am using the following code to print an existing document using word
automation. If I leave out the msgbox statement the document doesn't print.
It's almost as if the close happens before the print manages to get the
document out of word and into the print queue. Has anyone seen this? Any
suggestions? The "Press any key" solution is unprofessional to say the
least.

Function PrintWordDoc(strFilePath As String, strFileName As String, intCnt
As Integer) As Boolean
On Error GoTo Err_PrintWordDoc
Dim AppWord As Word.Application
Dim lDoc As Word.Document
Set AppWord = CreateObject("Word.Application")
With AppWord
.Visible = True
.Documents.Open (strFilePath & strFileName)
Set lDoc = .Documents(strFileName)
lDoc.PrintOut , , , , , , , intCnt

msgbox "Press any key to continue"

.Quit savechanges:=False
End With
PrintWordDoc = True
Exit_PrintWordDoc:
On Error Resume Next
Set lDoc = Nothing
Set AppWord = Nothing
Exit Function
Err_PrintWordDoc:
MsgBox Err.Description, , "Error in Sub basMailMerge.PrintWordDoc"
Resume Exit_PrintWordDoc
Resume 0 '.FOR TROUBLESHOOTING
End Function



John W. Colby
www.ColbyConsulting.com


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
 


---------------------------------
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster.


More information about the AccessD mailing list