Unique Tag for Printed Excel Spreadsheet

K

Keith

I am modifying a program that generates a report in the
form of an Excel spreadsheet, prints it, and saves it.

I need to come up with a method so that when the report is
initially printed by the program, it is unique from all
other printings of the report.

Basically, there needs to be a distinguishing
characteristic on the automatically printed report so that
it differs from other printings.

If the printed report is not unique from the saved
version, someone could manually alter the data in the
saved version and pass it off as the automatic print out.

The report is generated by a VB program and I'm new to
programming Excel with VB.

Any ideas?
 
J

Jake Marx

Hi Keith,

One option would be to store a hidden name in the workbook. Most users
won't know where to look for/modify these, as that must be done
programmatically.

So just before the SaveAs statement, you would do something like this:

Activeworkbook.Names.Add "hdtPrintDate", "=" & Format$(Now(), _
"yyyymmddhhmm"), False

To retrieve the name (and hence the date/time printed) later, you can do
this:

MsgBox Mid$(Activeworkbook.Names("hdtPrintDate").RefersTo, 2)

So you should be able to match the hidden name with the date/time the
workbook was last modified to see if it's been resaved since initial
printing.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
K

Keith

Tom,

It's pretty easy to just type in the same date and time in
the same location and print it, thus making the time both
reports were printed identical.

Can you be a little more specific?

Thanks,
Keith
 

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