Print Word Document stays in the spooling

DenizBerk

New member
Joined
Aug 7, 2023
Messages
2
Programming Experience
1-3
My printer works normally, but when I want to print with VB.Net, it stays in the spooling section. How can I print word file from the printer?

Dim wordApp As New Application()
Dim doc2 As Document = wordApp.Documents.Open(Locate & "\Document.docx")

Try
doc2.PrintOut()

' Close the document
doc2.Close()

' Quit the Word application
wordApp.Quit()

Catch ex As Exception
MessageBox.Show("Error: " & ex.Message)
End Try
 
I've seen some posts about this, but could not reproduce it myself, even with a very large document, for me the document finished printing long after I closed my app. It is possible in your case the printing is not finished spooling before close/quit, try this after PrintOut before close/quit, and declare method Async
VB.NET:
While wordApp.BackgroundPrintingStatus > 0
    Await Task.Delay(500)
End While
Possibly also use doc2.PrintOut(True) to set first argument Background.
 
I've seen some posts about this, but could not reproduce it myself, even with a very large document, for me the document finished printing long after I closed my app. It is possible in your case the printing is not finished spooling before close/quit, try this after PrintOut before close/quit, and declare method Async
VB.NET:
While wordApp.BackgroundPrintingStatus > 0
    Await Task.Delay(500)
End While
Possibly also use doc2.PrintOut(True) to set first argument Background.

Thanks for your help. But problem still continues.
 
Back
Top