ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing excel docs from VBA (https://www.excelbanter.com/excel-programming/367788-printing-excel-docs-vba.html)

[email protected]

Printing excel docs from VBA
 
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)


NickHK

Printing excel docs from VBA
 
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

wrote in message
oups.com...
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)




[email protected]

Printing excel docs from VBA
 
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

NickHK wrote:
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

wrote in message
oups.com...
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)



[email protected]

Printing excel docs from VBA
 
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

wrote:
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

NickHK wrote:
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

wrote in message
oups.com...
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)




All times are GMT +1. The time now is 01:27 PM.

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