The problem is :
if i use function now() and i open the document on the other day, cell value will be different.

some macro from pitonyak, just assign this macro to a button (will be easy)


'******************************************************************
'Author: Andrew Pitonyak
'email: [EMAIL PROTECTED]
'uses: FindCreateNumberFormatStyle
Sub InsertDateIntoCell
Dim oSelection 'The currently selected cell
Dim oFormats 'Available formats
REM Verify that this is a Calc document
If ThisComponent.SupportsService("com.sun.star.sheet.SpreadsheetDocument") Then
oSelection = ThisComponent.CurrentSelection
Rem Set the time, date, or date and time
'oSelection.setValue(DateValue(Now())) 'Set only the date
'oSelection.setValue(TimeValue(Now())) 'Set only the time
oSelection.setValue(Now()) 'Set the date and time
Rem I could use FunctionAccess to set the date and/or time.
'Dim oFunction 'Use FunctionAccess service to call the Now function
'oFunction = CreateUnoService("com.sun.star.sheet.FunctionAccess")
'oFunction.NullDate = ThisComponent.NullDate
'oSelection.setValue(oFunction.callFunction("NOW", Array()))
Rem Set the date number format to default
oFormats = ThisComponent.NumberFormats
Dim aLocale As New com.sun.star.lang.Locale
oSelection.NumberFormat = oFormats.getStandardFormat(_
com.sun.star.util.NumberFormat.DATETIME, aLocale)
Rem Set the format to something completely different
'oSelection.NumberFormat = FindCreateNumberFormatStyle(_
120
' "YYYYMMDD.hhmmss", doc)
Else
MsgBox "This macro must be run in a spreadsheet document"
End If
End Sub


Michael Adams wrote:
In calc you can record your own Macro, then set it to any free key
combination.

Start record:
 - Set function of cell to Today() or NOW()
 - Format - Cells (Numbers Tab)
    - Select date or time format desired
Stop Recording:

On Wed, 17 Jan 2007 09:36:54 +0700
Ahromi Irawan, Cirebon wrote:

unfortunately in my OOo.Calc (Ver 2.1) CTRL+F2 is "insert function"
in main menu insert.field is not exist or is missing.

sorry my bad english.
Ahromi Indonesia

NSP Ciudad Madero wrote:
RBL escribió:
Apparently OpenOffice doesn't have native keystrokes to insert current date or current time. In MSFT Office, it's Ctrl+; and Shift+Ctrl+; (if memory serves).

If anyone happens to have a macro or other keystroke-based approach
they use to do this in Writer and Calc, I would be most
appreciative.>
THANKS!!!
CTRL + F2 open the INSERT FIELD dialog, there you choose wich field you want to insert.

Saludos,
Roberto

-------------------------------------------------------------------
-- To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





The information transmitted is intended only for the person or the
entity to which it is addressed and may contain confidential and/or
privileged material. If you have received it by mistake please notify
the sender by return e-mail and delete this message including any of
its attachments from your system. Any use, review, reliance or
dissemination of this message in whole or in part is strictly
prohibited. Please note that e-mails are susceptible to change. The
views expressed herein do not necessarily represent those of PT Astra
International Tbk and should not be construed as the views, offers or
acceptances of PT Astra International Tbk.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







The information transmitted is intended only for the person or the entity to 
which it is addressed and may contain confidential and/or privileged material. 
If you have received it by mistake please notify the sender by return e-mail 
and delete this message including any of its attachments from your system. Any 
use, review, reliance or dissemination of this message in whole or in part is 
strictly prohibited. Please note that e-mails are susceptible to change. The 
views expressed herein do not necessarily represent those of PT Astra 
International Tbk and should not be construed as the views, offers or 
acceptances of PT Astra International Tbk.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to