Hello,
we want to change part of our outgoing mail content automatically when the user sends it. We want to insert certain words into the text depending on the following content. For example, to insert the first name “Reinhard” between the words “Mr.” and “Gruene”.
I want to do this by using the following script:
Sub Click(Source As Button)
[…]
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim ws As New NotesUIWorkspace
[…]
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Dim body As NotesRichTextItem
Dim rtnav As NotesRichTextNavigator
Set body = doc.GetFirstItem(“Body”)
Set rtnav = body.CreateNavigator
If rtnav.FindFirstString(“Gruene”, RT_FIND_CASEINSENSITIVE) Then
Call body.BeginInsert(rtnav)
Call body.AppendText ("Reinhard ")
Call body.EndInsert
End If
Call uidoc.Refresh
[…]
End Sub
I know there are no save and close statement, but let me tell what is happening:
I start this script with a button inside the form. If after that I open the property box to have a look at the fields, I see three “Body” fields. One with the Text before “Gruene”, the next with "Reinhard " and the last with the text from “Gruene” forward. When I save this document, only one Body field is left and it has the same content as before the whole action.
I don’t do this very often, so maybe it is just a beginners mistage. Has anyone an idea? Thanks in advance!
Regards
Reinhard Grüne