Reputation: 43
I am currently using ShellExecute to print a PDF using the below code.
The PDF is being printed alongside other (Word) documents. However, I need them to print out in a specific order, which is a problem because the PDFs take longer to be sent.
Is there a way to check if the PDF was sent to the printer before moving on to the next line of code?
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _
ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
ShellExecute Application.hwnd, "Print", formPath, 0&, 0&, 0&`
Upvotes: 4
Views: 1118
Reputation: 432
Lots to read here, and honestly, above my skill set, but it looks to answer your question.
It may also be as simple as just checking the count in the printer queue. If the previous file was a .PDF, then only print the next file if the queue count is equal to zero.
Printer Queue Count... http://visualbasic.happycodings.com/applications-vba/code9.html
Tons of printer options... http://www.merrioncomputing.com/Programming/WatchPrinter.htm
Upvotes: 1