On Friday 27 November 2009, Andreas Saeger wrote:
> bill purvis wrote:
> > On Friday 27 November 2009, Richard Detwiler wrote:
> >> bill purvis wrote:
> >>> On Friday 27 November 2009, Andreas Saeger wrote:
> >>>> bill purvis wrote:
> >>>>> I am working on a multi-sheet parts list spreadsheet and it would be
> >>>>> really useful if I could automatically insert the date of the most
> >>>>> change at the bottom of each sheet. I can see that I can enter the
> >>>>> 'current' date, but I'd really like the date at which any of the
> >>>>> sheets were last modified. At present I have a hidden field on sheet1
> >>>>> and copy this to all the relevant cells, but then I have to unhide
> >>>>> the cell, update the content, and re-hide it each time I change
> >>>>> something. Is there such a function - I couldn't see it in the help
> >>>>> list.
> >>>>>
> >>>>> Bill
> >>>>
> >>>> Type the address or name of the cell into the name box left of the
> >>>> formula bar.
> >>>> Then type into the formula bar: =NOW() F9 Enter Enter
> >>>
> >>> No good! I want to be able to open the spreadsheet and see when it was
> >>> last modified - NOW() gets updated when you load a SS, otherwise it
> >>> would be the answer. Thanks anyway!
> >>>
> >>> Bill
> >>
> >> Bill: Did you actually try his suggestion? I just did, and it does NOT
> >> update when you save and then re-open the file.
> >
> > It did for me - the spreadsheet has a fair number of calculations in
> > it and I would expect it to recalculate when it is loaded.
> >
> > I'm thinking now about using a script to be invoked when I save the
> > file - Just looked at Tool-Configure-Events and see that there are
> > some relevant events - Save, after Save, Save As, after Save As.
> > I presume I could set a script to be invoked for the Save event
> > whic I presume could be made to store the date (as text) into the
> > hidden cell that I am currently using. I need to dig around and see
> > if I can find any tutorial on scripting in calc.....
> >
> > Bill
>
> http://user.services.openoffice.org/en/forum/viewtopic.php?f=21&t=12575
>
Thanks for the link. With the help of that and:
http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide
I've managed to cobble together a simple macro to write the current
date into a specific cell, and then arranged for this to be invoked
whenever I save the spreadsheet. Macro is:
----------------------------------------
REM ***** BASIC *****
Sub TimeStamp()
Dim sheet as object
Dim c as object
sheet = thisComponent.Sheets(0)
c = sheet.getCellRangeByName("B1")
c.setValue(Now())
End Sub
-----------------------------------------
The value in sheet(0).B1 is then propogated to a cell in each of the
sheets to appear when I print them.
Many thanks for the various tips and references...
Bill
--
+---------------------------------------+
| Bill Purvis, Model Engineer |
| email: [email protected] |
+---------------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]