ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Printing through the Excel Object Library (https://www.excelbanter.com/excel-programming/277721-printing-through-excel-object-library.html)

Shay Friedman

Printing through the Excel Object Library
 
Hi,

My target is quite clear:
1) Open an excel workbook.
2) Print it to a file
3) Copy the file to a new location

Pretty simple, huh? Well, I found it to be a bit tricky.

I am able to automatically do the workflow mentioned above but something is
missing...
In the MS-Word Object Library, the ApplicationClass has a property which is
something like BackgroundPrintingStatus... when that becomes -1 I know that
the printing actions is done. I couldn't find this or a familiar property in
the excel library.

My question is - how can I wait until excel finishes to print the workbook
and only then go on with my code?

Thanks,
Shay



Tom Ogilvy

Printing through the Excel Object Library
 
print it in the foreground (not sure there is a background option in Excel).

Public sub Printit()

set wkbk = workbooks.Open("C:\My Folder\MyBook.xls")
wkbk.Printout
wkbk.SaveAs "C:\My Other Folder\BookBak.xls"
wkbk.Close SaveChanges:=False

End sub

each instruction won't fire until the previous action is complete.

--
Regards,
Tom Ogilvy

Shay Friedman wrote in message
...
Hi,

My target is quite clear:
1) Open an excel workbook.
2) Print it to a file
3) Copy the file to a new location

Pretty simple, huh? Well, I found it to be a bit tricky.

I am able to automatically do the workflow mentioned above but something

is
missing...
In the MS-Word Object Library, the ApplicationClass has a property which

is
something like BackgroundPrintingStatus... when that becomes -1 I know

that
the printing actions is done. I couldn't find this or a familiar property

in
the excel library.

My question is - how can I wait until excel finishes to print the workbook
and only then go on with my code?

Thanks,
Shay






All times are GMT +1. The time now is 03:42 PM.

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