I’ve got a Lotusscript agent that’s supposed to compose a memo, write text in the Body, and attach a file to the Body. However, the file attachment is what only appears in the Body; the text gets overwritten. Anyway to display both?
Subject: Attach file and text to a richtext field using Lotusscript
What code are you using? Post it and perhaps we can assist.
Subject: RE: Attach file and text to a richtext field using Lotusscript
Sub Click(Source As Button) Dim ws As New NotesUIWorkspace
Dim uiview As NotesUIView
Dim uidoc As NotesUIDocument
Dim s As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim docMemo As NotesDocument
Dim rtitem As NotesRichTextItem
Dim object As NotesEmbeddedObject
Set uiview = ws.CurrentView
Set uidoc = ws.CurrentDocument
Set db = s.CurrentDatabase
Set view = db.GetView ("(TSSummariesNotEmailed)")
Set doc = view.GetFirstDocument
While Not doc Is Nothing
Set doc = view.GetFirstDocument
Call ws.EditDocument
Set uidoc = ws.CurrentDocument
Call uidoc.FieldSetText ("emailed", "Yes")
Set docMemo = New NotesDocument (db)
docMemo.Form = "Memo"
docMemo.Subject = "Dependable Computer Guys, Inc. Invoice #" & uidoc.FieldGetText ("Invoice")
Set rtitem = New NotesRichTextItem (docMemo, "Body")
Set object = rtitem.EmbedObject (EMBED_ATTACHMENT, "", "i:\" & uidoc.FieldGetText ("Invoice") & ".pdf")
docMemo.Body = "Attached is invoice #" & uidoc.FieldGetText ("Invoice") & "." & Chr$(10) & Chr(13) &_
"If you have any problems opening the attachment or have questions regarding your invoice, please do not hesitate to call." &_
Chr$ (10) & Chr$ (13) & "Thank you for choosing Dependable Computer Guys." & Chr$(10) & Chr$(13) &_
"Accounting Department" & Chr$(10) &_
"Dependable Computer Guys" & Chr$ (10) &_
"(818) 541-9195"
docMemo.SendTo = "eddie@dcgla.com"
docMemo.Send (False)
Call uidoc.Save
Call uidoc.Close (True)
Call view.Refresh
Wend
End Sub
Subject: Try calling the Update method before you send.
Subject: RE: Try calling the Update method before you send.
I’ve tried that too. Didn’t work. I’ve tried moving lines of code every which way, but no luck.
Subject: RE: Try calling the Update method before you send.
Ah. You can’t put text into a rich text field using =, as in:
docMemo.Body = "…
That’s how you assign a text field. For rich text, use NotesRichTextItem.AppendText.