Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

marspark
Participant
0 Kudos
997

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 ( https://msdn.microsoft.com/en-us/vba/excel-vba/articles/workbook-object-excel) , 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?

1 ACCEPTED SOLUTION

pokrakam
Active Contributor
616

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?

10 REPLIES 10

pokrakam
Active Contributor
617

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?

0 Kudos
616

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 ).

pokrakam
Active Contributor
0 Kudos
616

Two words: copy, paste.

0 Kudos
616

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.

pokrakam
Active Contributor
616

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.

616

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.

0 Kudos
616

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.

0 Kudos
616

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

che_eky
Active Contributor
0 Kudos
616

Zhe,

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.

Che

0 Kudos
616

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.

Thanks.