Printing excel docs from VBA

I

igniztion

Hi,

I need to print Excel workbooks from an Access vba application, and
usually this works without any troubles. In some cases though, when
running

oExcel.Application.ActiveWorkbook.WorkSheets(arr).PrintOut

where the array contains the names of all visible sheets in the
workbook, some of the sheets don't print. I've checked that the names
are correct in the array. I've also tried different functions like
ActiveWorkbook.Printout, ActiveWindow.SelectedSheets.Printout (when I
know that all the sheets are selected) etc

For some reason som of the sheets don't print. If I open the excel doc
manually and prints the workbook then every visible sheet is printed.

Does anyone have any idea what can be done to avoid this, or is it
something done in the creation of the Excel docs perhaps? (Can't really
do much about that. We have around 60 people all over Europe creating
these documents)
 
N

NickHK

If you braek it up do they all print

Dim WS as worksheet
for each ws in oExcel.Application.ActiveWorkbook.WorkSheets(arr)
ws.printout
next

NickHK
 
I

igniztion

Yes they all print then, but that doesn't solve my problem. The thing
is that I print these sheets through a pdf converter and if I print
each sheet independently I suddenly have the same number of pdfs as
there are sheets in the Excel document. This would leave me with the
task to try and merge heaps of pdfs into one to upload the completed
final document to the server.

Is this a bug in the PrintOut function that it sometimes skips certain
sheets when printing a compelte workbook?

Vegard
 
I

igniztion

Hi again,

I found that the pdf converter we use had a nifty append function to
merge pdfs so the solution from NickHK was what I went for. Thanks for
your input!

Vegard
 

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