Fog Creek Software
Discussion Board




Excel: unique ID on every printout, please help.

I'm MS Excel guru by no terms. Still I've been asked if  there is a way of having a unique (sequential) number automatically in a corner of every copy of the same spreadsheet printed out. Something like document ID. You help and ideas will be greatly appreciated.

Vlad Gudim
Thursday, July 08, 2004

Sure there is.  Hand Bob the mailroom guy a magic marker, and point him at those spreadsheets, baby.

muppet from madebymonkeys.net
Thursday, July 08, 2004

sort of a do it yourself DRM?

.net, the equivalent of MS Bob.
Thursday, July 08, 2004

muppet from madebymonkeys.net

we are trying to be facetious, aren't we?

Vlad Gudim
Thursday, July 08, 2004

I think the Date Time is the closest your going to get.

You won't be able to trust the sequential ID.

For example, say you load two separate copies by mistake print from one copy, then print from the other copy.

Ged Byrne
Thursday, July 08, 2004

Ged,

yes, right... And, in addition, most modern printers and their drivers would optimise printing multiple copies, by sending only one page + number copies required. 

I know it's not a brilliant idea at all.

Vlad Gudim
Thursday, July 08, 2004

For what unholy reason could anyone ever need this in the first place?  They're not going to prevent anyone leaking sensitive data this way.  The freaking number can be whited out.

muppet from madebymonkeys.net
Thursday, July 08, 2004

maybe a macro


Thursday, July 08, 2004

muppet from madebymonkeys.net

when a group IT manager says "jump", you jump, you don't question his wisdom, until you're in a position.

Vlad Gudim
Thursday, July 08, 2004

"when a group IT manager says "jump", you jump, you don't question his wisdom, until you're in a position."

If I was hired to be a developer, then I'm already IN a position to do this.  I ask questions like "What is the result you're trying to achieve, what is the goal?" Usually I can help them reach a solution that meets their needs, but isn't necessarily on the same plane of thinking.  In any case it's much easier to solve a problem if you first UNDERSTAND THE PROBLEM.

If you've been hired as a software engineer/developer/what-have-you, then you've been hired for your expertise, no?  Unless your title is "Code Monkey".

muppet from madebymonkeys.net
Thursday, July 08, 2004

We've all had to waste our time on worthless tasks for the PHB just because he had an idea sitting on the toilet one day.

If say can't be done, and no reason to do it.  If you want to do document management do it properly.

Ged Byrne
Thursday, July 08, 2004

muppet from madebymonkeys.net

No offence, but "In theory there are no difference between practise and theory. On practise, however, there are a difference."

Take people even as smart as Joel - if they want to work for a real software company, they have to start one.

Vlad Gudim
Thursday, July 08, 2004

Excel Macro recording is fun.

Here's a solution:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
  Dim MyVal As Integer
    Range("A1").Select
    MyVal = ActiveCell.Value + 1
    ActiveCell.Value = MyVal
   
    With ActiveSheet.PageSetup
      .CenterFooter = MyVal
    End With

    Range("A2").Select
End Sub

And here's an explanation:
1.  The Excel 'Document' has a '_BeforePrint' method.  You can instantiate one of those.

2.  Have a cell on your spreadsheet with the number in it.  The above macro assumes it is in A1, but it could be anywhere.

3.  The above macro increments that, then copies it to the Footer, when 'File, Print' is selected in Excel.  Then Excel prints the page with the updated number.

AllanL5
Thursday, July 08, 2004

Yup, and then don't forget to save the spreadsheet!

MilesArcher
Thursday, July 08, 2004

Depending on the need, the easiest solution may be to send the pages of the spreadsheet through the printer twice. The second time with a little program that prints a sequential number on each page. Or you could just create a word documnet with a page number in the footer and <number> page breaks.

Rich
Friday, July 09, 2004

Thanks folks, your help is great. I'll forward your ideas to the guy who asked.

Vlad Gudim
Friday, July 09, 2004

*  Recent Topics

*  Fog Creek Home