0

I am trying to automate a mailing system where an edited word document will be mailed to number of people through Lotus Notes.

I am using this following code to do so. This code works fine except it loses all its formatting(e.g. bold, italics, paragraph etc) while it is being sent as a mail.

Set objRange = ob_doc.Content
mailtext = ob_word.CleanString(objRange.Text)

'Create the mail document
Set notesDocument = notesDatabase.CreateDocument
'set to memo format
notesDocument.Form = "Memo"
'Set the subject
notesDocument.Subject = subject
'Set the body
Set notesRichTextItem = notesDocument.CreateRichTextItem("Body")
notesRichTextItem.AppendText(mailtext)

... After doing some research, I tried to convert the word doc to html to keep the formatting intact, but I could not mail that html file as the mail body.

Deduplicator
  • 44,692
  • 7
  • 66
  • 118

3 Answers3

1

You'll need to use the MimeEntity classes in Notes to send the email as HTML. See this SO Answer for more information: Sending formatted Lotus Notes rich text email from Excel VBA

Community
  • 1
  • 1
Ken Pespisa
  • 21,989
  • 3
  • 55
  • 63
0

Or you could just send the Word document as an attachment. It's not as elegant, but is simple to code.

David Navarre
  • 1,022
  • 10
  • 27
0

You are asking for headaches if you want a Word document to appear in a Notes client (or any other email client) in the same way that it appears in MS Word. The closest solution would be to use MS Word to save the document as HTML (as you mentioned), then use the Notes MIME classes to create the email using the HTML generated by Word (as Ken mentioned). The biggest problem that you will face is in the way that Word uses styles. Different email clients have different requirements for styles, and Notes is pretty picky - for example, all styles must be inline (not global or external), which Word will not do.