Wonder if someone could explain this problem to me. I have the following code running in my QuerySend event of the memo form:
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim SigString As String
Dim Body As String
Body = source.FieldGetText("body")
Call source.GotoField("body")
If Instr(1, body, "<<sig>>", 5)>0 Then
Call source.FindString("<<sig>>", False, False, False, False, False, False, True, True, True)
Call source.InsertText("Some Text")
End If
The idea is that when the email comes to be sent, the body field is searched for “<>” and if it’s found, it replaces the found string.
This works perfectly, unless a very specific condition is met.
The condition is when an email is forwarded and the text being searched for has been added to the forwarded text, below the line stating that the email has been forwarded.
When this happens, uidoc.fieldgettext(“body”) only returns the text which has been added to the newly created forward, ie only that above the forwarded line.
This means that the Instr line in the code cannot search the forwarded text.
However, when the cursor is in the body field and the uiDoc.FindString is used, it searches the entire contents of the field and finds the text even if it’s in the forwarded text.
So my question is why does uiDoc.Fieldgettext(“body”) only get the text above the forwarded email text, while uiDoc.FindString can search the whole body field?