Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date / time stamp in documents

Status
Not open for further replies.

Fret4u

MIS
Dec 13, 2004
26
NL
Is there an easy way to add date and/or time to documents in Lotus Notes ? Like MS Word shift+alt+D for date and shift+alt+T for time.
Thanks
 
I dont think so without coding an agent maybe. Why would you want to anyhow? The time and date are in the header information already.
 
In mail it is in the header, but in own made databases it does not have to be. I have such a database in which amongs others telephone calls are registered. At some point I have to insert date and/or time. Now I have to type it. But I would like to have this task automated. Would you by any chance have any suggestions how I would have to program an agent to have these tasks performed ?
Thanks in advance.
 
The following code works as an agent run from the actions menu after selecting docs to run it on. I am sure that someone with more knowledge of lotusscript than me (pascal?) can reduce this somewhat. I modified an existing example that I found so that it would do what you were after. Please test on dummy data before trusting this as I am a novice really when it comes to scripting.

Mark.

Sub Initialize
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim uiDoc As NotesUIDocument
Dim db As NotesDatabase
Dim coll As NotesDocumentCollection
Dim doc As NotesDocument

Set db = s.CurrentDatabase
On Error Resume Next
Set uiDoc = ws.CurrentDocument
If Err <> 0 Then
Err = 0
Set uiDoc = Nothing
End If
If uiDoc Is Nothing Then
Set coll = db.UnprocessedDocuments
If coll.Count = 0 Then
Msgbox "Please choose a document to be processed!!", 16, "None Selected"
Exit Sub
End If
Set doc = coll.GetFirstDocument
Else
Set coll = Nothing
Set doc = uiDoc.Document
End If
While Not doc Is Nothing
Dim rtitem As Variant
'...set value of doc...
Set rtitem = doc.GetFirstItem( "Body" )
If ( rtitem.Type = RICHTEXT ) Then
Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText("Time&Date Stamp:" )
Call rtitem.AppendText(Date$ )
' Call rtitem.AddNewLine( 1 )
Call rtitem.AppendText(" " )
Call rtitem.AppendText(Time$)
Call doc.Save( False, True )
End If
If coll Is Nothing Then
Set doc = Nothing
If uiDoc.EditMode Then Call uiDoc.Reload
If uiDoc.EditMode Then Call uiDoc.Refresh
Else
Set doc = coll.GetNextDocument(doc)
End If
Wend


End Sub
 
Thanks for the script / agent, but - if I understood it correctly - it works on selected documents.But I want to use it in a document. And by the way, I get an error. Is there a simple way like a smart icon and then the formula / command @today ?
 
In a date field you can type Today, Yesterday or Tomorrow and the requisit date will appear.
Beyond that, you're supposed to use the date picker. If there is none, ask the designer to include it. It will make your life easier.

Pascal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top