PDA

View Full Version : Printing all worksheets in a workbook as a single file..



Jade
04-29-2010, 01:24 AM
Hi,

This may seem as a repetitive post but instead of macro progg or even VBA progg I am using VB6 to print worksheets present in a workbook as a single file. Code for the same is posted below...

###############################

xlApp.Worksheets("Sheet1").Select Replace:=False
xlApp.Worksheets("Sheet2").Select Replace:=False
xlApp.ActiveWindow.SelectedSheets.PrintOut Copies:=1

###############################

Above code prints only the current sheet..

Any ideas..? :doh:

Thanks
Jade

Bob Phillips
04-29-2010, 01:52 AM
Try this



xlapp.Worksheets(Array("Sheet1", "Sheet2")).Select
xlapp.Worksheets("Sheet1").Activate
xlapp.ActiveWindow.SelectedSheets.PrintOut Copies:=1

Jade
04-29-2010, 02:22 AM
thanks for replying xld.

the code again printed only sheet1 of the workbook....!:(

Can v try something else...!!

Thanks
Jade

Bob Phillips
04-29-2010, 03:25 AM
Jade,

I just tried it again, admittedly on this excel app, but it printed out two pages or me.

Jade
04-29-2010, 03:39 AM
by two pages do we mean two sheets..?

Thanks,
Jade

Bob Phillips
04-29-2010, 04:28 AM
Yes, sorry, I mean both of the sheets.

Jade
04-29-2010, 04:36 AM
I am doing exactly the same but the results are not the same...:bug:

I hope there isn't anything else that i need to do...!!!

Even in the printer tray the jobs are coming as two separate processes..

Any suggestions ?

Thanks,
Jade