Skip to Content

How to know whether document is only printed or only viewed as print preview in EXCEL?

Apr 07 at 11:50 AM


avatar image

Dear All,

We are trying to build a control on printing of document, by setting the indicator for the record as printed once user prints the record.

But, is there any way to find out if user has only done print preview or actually printed the document?

In SAP Smart Forms, there is a flag OUTPUTDONE in parameter JOB_OUTPUT_INFO, which indicate whether document is printed or not. But we print document by using EXCEL file, OLE.

As description in MSDN ( , it seems there is not "printed" property in the wookbook object. So, how to know whether document is only printed or only viewed as print preview in EXCEL?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Mike Pokraka Apr 07 at 06:12 PM

I think this is either not possible, or else it won't be reliable. What if someone does a "Save as" and prints it later? Or does an Excel to PDF output?

Show 7 Share
10 |10000 characters needed characters left characters exceeded

By calling method "PrintPreview", "Close" and "Quit", program can prevent the files from being saved . Because users can't save or edit file in PrintPreview mode. If user does an Excel to PDF output, it will be considered as "printed"(By smartforms,they can do the same things ).


Two words: copy, paste.


If you create a new Excel file, fill some words in it, then COPY and PASTE the file, you will find nothing in the newest file. Because the document is not SAVED.


You're missing the point.

If you show an Excel from SAP the user can "Save as" a local file. Or they can copy/paste into new spreadsheet and save, print, email - SAP has no control or knowledge of what happens.


Oh, I see. I thought program could control the processing by OLE before. But now I see if SAP GUI processing is killed, user will be free to handle the EXCEL file. It is indeed unreliable. Thank you.


I agree with Mike, as soon as you open Excel and let user do anything, you no longer control the process. Whatever you do here will be unreliable. I actually doubt this is worth investment. If using standard SAP output functionality, there is an option in configuration to propose output only once. So the output won't be proposed automatically anymore yet this will still allow an authorized person to reprint a copy, if needed.

Personally, I feel some companies tend to exaggerate both the risk of printing another copy of a document and their ability to prevent this (imaginary) risk.

Jelena Perfiljeva

Yes, I agree with you. It is a wrong way...

Che Eky Apr 18 at 04:24 PM


I am not an expert in Excel. From the link you shared you could maybe use BuiltinDocumentProperties to retrieve the property called "Last Printed". Not sure if this will help and not sure how you can pass this back to SAP.

As an alternative, on return from Print Preview, you could ask the user if the document was printed or not (in a popup). Not the best solution but an option.


Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Che,

The "Last Printed" property will be updated when program calls method "PrintPreview", and this calling is nessesary....

By the disscusion with Mike, I have realized that it is unreliabe to control the process by OLE.