| View previous topic :: View next topic |
| Author |
Message |
Johm Newbie

Joined: 31 Mar 2007 Posts: 3
|
Posted: Sat Mar 31, 2007 3:59 am Post subject: Date and time stamp or Version number |
|
|
Hello!
I donīt know what is possible.
When I print a sheet I will have a version number in some Cell.
Maybe the best (I think) is the date/time in a cell when the file i last changed.
(or last printed)
I have seek information how I can use the result under "File/Property"
(Where You can find Creation date, Last modify, Last Printed and so on)
How can I get some information like this in a Cell?
// Jan |
|
| Back to top |
|
 |
Mark B Super User


Joined: 16 Feb 2007 Posts: 852 Location: Lincolnshire, UK
|
Posted: Sat Mar 31, 2007 4:30 am Post subject: |
|
|
Hi Jan
A simple macro will do the job (it'll put the timestamp in A1 in Sheet1):
| Code: |
Sub timestamp
oDoc = thiscomponent
oSheet = oDoc.Sheets(0)
oCell = oSheet.getCellRangeByName("A1")
oCell.String = oDoc.DocumentInfo.ModifyDate.Day _
& "/" & oDoc.DocumentInfo.ModifyDate.Month _
& "/" & oDoc.DocumentInfo.ModifyDate.Year _
& " " & oDoc.DocumentInfo.ModifyDate.Hours _
& ":" & oDoc.DocumentInfo.ModifyDate.Minutes
End Sub
|
You can then assign this to the "Print Document" event of the document (via Tools | Customize )
Mark _________________ Mark B's Articles |
|
| Back to top |
|
 |
Johm Newbie

Joined: 31 Mar 2007 Posts: 3
|
Posted: Sat Mar 31, 2007 1:33 pm Post subject: |
|
|
Thankīs for the code!
Now is the problem:
How can I make the macro (in Calc)?
//Jan |
|
| Back to top |
|
 |
Mark B Super User


Joined: 16 Feb 2007 Posts: 852 Location: Lincolnshire, UK
|
Posted: Sun Apr 01, 2007 2:04 am Post subject: |
|
|
To add a new macro:
- Click on Tool| Macros | Organize Macros | OpenOffice.org Basic;
- Select My Macros | Standard | Module1 and then click Edit;
- Cut and paste the code above into the new window.
To see it in action click in a spreadsheet, then this window and then press the 'Run Basic' button on the toolbar.
Mark _________________ Mark B's Articles |
|
| Back to top |
|
 |
Johm Newbie

Joined: 31 Mar 2007 Posts: 3
|
Posted: Sun Apr 01, 2007 7:47 am Post subject: |
|
|
Thankīs a lot, it works fine
//Jan |
|
| Back to top |
|
 |
teror Newbie

Joined: 17 Apr 2009 Posts: 2
|
Posted: Fri Apr 17, 2009 3:35 pm Post subject: how cani.... |
|
|
how can i run a macro with an if...then...stament from another cell?
i want to put a timestamp in a cell when a value has been entered into an adjacent cell
i am doing a survey and entering in prices into one column and i want an automated timestamp to appear next to it when i've entered in the price.
i currently use an if statement to check for a blank cell and then use the Now() function however this updates all previous cells as well. i need the timestamp to stay current after the adjacent cell has been updated. |
|
| Back to top |
|
 |
|