I have a document with some information (pdf-filename, mailaddress, some Text in body field…)
The user has to click on a button which downloads the pdf, creates new memo and attaches the pdf. The memo’s body field contains the same text as the body field of the document.
Now the problem: The signature which is added automatically (tools/mail preferences) is above the text I copied from the document’s body item.
Thanks 4 help.
some lines of code:
Dim DocBody As NotesRichtextItem
Set DocBody = doc.GetFirstItem(“Body”)
Dim BodyItem As New NotesRichtextItem (memo, “Body”)
for bonus points, here’s some code to re-insert the signature after you have opened the memo for editing
With mailUiDoc
REM: kludge to move cursor to the end
Call .GotoField("Body")
Call .selectAll
Call .cut
Call .paste
End With
REM: re-insert signature
Dim sigOption As String
sigOption = docProfile.SignatureOption(0)
If sigOption = "1" Then 'text
Call mailUiDoc.FieldAppendText("Body", docProfile.Signature_1(0))
Elseif sigOption = "2" Then 'file
Dim filePath, extension, fileFilter As String
filePath = docProfile.Signature_2(0)
extension = Right(filePath, Len(filePath) - Instr(filePath, "."))
Select Case extension
Case "jpeg", "jpg":
fileFilter = "JPEG Image"
Case "gif":
fileFilter = "GIF Image"
Case "bmp":
fileFilter = "BMP Image"
Case "htm", "html":
fileFilter ="HTML File"
Case "txt":
fileFilter ="ASCII Text"
End Select
Call mailUiDoc.Import(fileFilter,filePath)
End If
and it crashes the notes client (V. 7.0.3) if the body already contains a file attachment. Is there any chance to insert a html signature if the body contains already an attachment?
I considered entering a change request to have the signature automatically inserted at the bottom, but I’m afraid that would mess up other functions – forwarding, for instance, needs to hae the signature at the top.
Here’s another idea. Look at the memo code to figure out what information in the user’s profile document tells the memo form to have the signature inserted. Temporarily modify the profile document to not insert a signature. Open the new memo. Then restore the profile (since the profile is cached, you may even be able to avoid modifying it by simply not saving the original change, and using Delete to remove it from cache). If you want to get fancy you could copy the code from the mail template that inserts the automatic signature, and have your code insert it at the end.
Or. perhaps there’s some form field the code looks at to exempt a memo from having a signature inserted.