convert multiple sheets into PDF

G

geebee

hi,

i have some code to convert multiple sheets to PDF. i can get up to 3
sheets into one PDF file, but when i do anything more than that it only
prints the last sheet selected instead of all of them. here is my sample:

Sheets(Array("VGA Summary", "1Q Test", "1N Test")).Select
ActiveWindow.SelectedSheets.PrintOut , ActivePrinter:="PDFCreator"

i would like to add more sheet names to the array, but when i do it wont work.

thanks in advance,
geebee
 
R

Ron de Bruin

I never used PDFCreator but you can do this

Sheets(Array("VGA Summary", "1Q Test", "1N Test")).Copy

Add your other sheets in the array

You have a new workbook now with all your sheet
create a pdf of this workbook and delete the file
 
G

geebee

hi,

i am not sure what you mean by this. i mean what would be the code? is
there a better way to write the coee instead of using an array?

thanks in advance,
geebee
 
R

Ron de Bruin

Something like this

Dim wb As Workbook
Sheets(Array("VGA Summary", "1Q Test", "1N Test")).Copy
Set wb = ActiveWorkbook

wb.PrintOut , ActivePrinter:="PDFCreator"

wb.Close False
 
G

geebee

hi,

i tried your code recommendation. basically what it did was copy the sheets
to a new workbook. now everything works fine as long as you have 3 sheets or
less. but when you have more than 3 sheets, only the last one is saved as
the pdf.
why is this?

thanks in advance,
geebee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top