![]() |
Pause Printing in VBA
:) Hello!!
I have written a Macro in VBA to print Invoices with data from an Excel Worksheet. But I have about 250 Bills to print. Could someone tell me how I can include a few more lines of code in my Macro that will enable pauses in the printing, at a keystroke ?! I would very much appreciate a solution that is not very difficult !! Thank You !! Vijay |
Pause Printing in VBA
I doubt if there is a way to do that. Maybe you should only print 25 to 50 bills at a time. Helpful newsgroup posting tips here... http://www.cpearson.com/excel/newposte.htm -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Vijay Chary" wrote in message :) Hello!! I have written a Macro in VBA to print Invoices with data from an Excel Worksheet. But I have about 250 Bills to print. Could someone tell me how I can include a few more lines of code in my Macro that will enable pauses in the printing, at a keystroke ?! I would very much appreciate a solution that is not very difficult !! Thank You !! Vijay |
Pause Printing in VBA
On Mar 29, 4:37 pm, "Jim Cone" wrote:
I doubt if there is a way to do that. Maybe you should only print 25 to 50 bills at a time. Helpful newsgroup posting tips here...http://www.cpearson.com/excel/newposte.htm -- Jim Cone San Francisco, USAhttp://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "Vijay Chary" wrote in message :) Hello!! I have written a Macro in VBA to print Invoices with data from an Excel Worksheet. But I have about 250 Bills to print. Could someone tell me how I can include a few more lines of code in my Macro that will enable pauses in the printing, at a keystroke ?! I would very much appreciate a solution that is not very difficult !! Thank You !! Vijay Hello Vijay, This macro may help you. You need to be running Excel 2002 or above. Macro Code ================================================== ==================================== 'Written: March 30, 2008 'Author: Leith Ross 'Summary: Pause a local printer by name 'Note: Windows 2000 and Windows NT 4.0 - This method is not available. Sub PausePrinter(ByVal Printer_Name As String) strComputer = "." Printer_Name = Printer_Name & " on ADMINS" '& Environ("ComputerName") Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colPrintJobs = objWMIService.ExecQuery("Select * from Win32_Printer") For Each objPrintJob In colPrintJobs 'objPrintJob.Pause - Change this to objPrintJob.Resume to comntinue If Printer_Name = objPrintJob.Name Then objPrintJob.Pause Next objPrintJob End Sub ================================================== ===================================== Sincerely, Leith Ross |
All times are GMT +1. The time now is 02:57 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com