ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   printing macro? (https://www.excelbanter.com/excel-programming/376603-printing-macro.html)

James Cornthwaite

printing macro?
 
I have (with help) written the following macro.

It essentially prints the first page of every worksheet in a workbook

with the exception the "import" and "client details worksheets".


My problem is this macro code causes each page to be sent to the printer as
a seperate job.
This wouldn't be a problem but i'm in a busy office (and though quick) other
printouts will sneak in between the pages.

Is there any coding variation which would lead to only one job being sent to
the printer.


Many thanks in anctipation.

James


Sub PrintFullAccounts()

Dim theSheet As Worksheet

For Each theSheet In ActiveWorkbook.Worksheets
If theSheet.Name = "import" Or theSheet.Name = "client details" Then
'do nothing
Else
'print first page
theSheet.PrintOut From:=1, To:=1, Copies:=1
End If

Next theSheet

End Sub



Dave Peterson

printing macro?
 
Untested...

How about a miserable workaround.

Instead of printing to the printer, you print to a different file for each
sheet.

It would be printer type specific--the files would have all that specific
printer's control characters embedded in that file. (Put the files in a
dedicated folder--nothing else there to make life easier.)

Then you could shell to DOS and concatenate the .prn files into one large file:
copy /b *.prn AllPRN.ALL

Then copy that to your printer:
copy /b allprn.all lpt1:





James Cornthwaite wrote:

I have (with help) written the following macro.

It essentially prints the first page of every worksheet in a workbook

with the exception the "import" and "client details worksheets".

My problem is this macro code causes each page to be sent to the printer as
a seperate job.
This wouldn't be a problem but i'm in a busy office (and though quick) other
printouts will sneak in between the pages.

Is there any coding variation which would lead to only one job being sent to
the printer.

Many thanks in anctipation.

James

Sub PrintFullAccounts()

Dim theSheet As Worksheet

For Each theSheet In ActiveWorkbook.Worksheets
If theSheet.Name = "import" Or theSheet.Name = "client details" Then
'do nothing
Else
'print first page
theSheet.PrintOut From:=1, To:=1, Copies:=1
End If

Next theSheet

End Sub


--

Dave Peterson


All times are GMT +1. The time now is 01:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com