Thread: Print time
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2528_] Rick Rothstein \(MVP - VB\)[_2528_] is offline
external usenet poster
 
Posts: 1
Default Print time

You can do what you want by using a workbook event procedure. Right click
the Excel icon immediately to the left of the File menu item, select View
Code from the menu that pops up and copy/paste this code into the code
window that opened up...

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Worksheets("Sheet1").Range("H87").Value = Now
End Sub

Note that I was not entirely clear which worksheet you wanted this date in,
so I assumed Sheet1 for example purposes. What confused me somewhat is that
you said "...the time the WORKSHEET is printed" {emphasis mine}. If you
meant that you want the time saved on the particular worksheet you were
printing, then, assuming that worksheet would always be the active sheet
when you were printing it, just change the Worksheets("Sheet1") reference to
ActiveSheet instead. If you have some other need for where this date is
stored, you will have to provide a more detailed description of your needs.

Rick


"Patrick C. Simonds" wrote in message
...
In cell H87 I have the formula below which of course gives the time the
file is opened, but it seems I need to have the time the worksheet is
printed. The workbook tends to be open most of the day and is printed each
time a change is made.

=NOW()