1
votes

Is it possible to use VBA to create a Lotus Notes email/document using an existing RTF file?

Assuming that the computer is installed with a Lotus-Notes Client

1

1 Answers

1
votes

Yes, you can use the Lotus Notes/Domino COM or OLE classes. The COM classes do everything in the background. The client must be installed, but it doesn't have to be running. The OLE classes drive the client UI, so the client will start automatically if it isn't already running and the VBA code will interrupt whatever it is doing.

There is nothing in the Lotus APIs, however, to deal with automatically translating an RTF file into a nicely formatted Notes rich text field. The method AppendRTFile() in the NotesRichTextItem class does not work with a conventional RTF. It's older than RTF being considered a "standard" format, so the terminology is confusing, but it's dealing only with special files that store data in Notes' own internal rich text format. You'll be on your own with that part. Your best bet is probably going to be to find a way to convert the RTF to HTML and then use the NotesMIMEEntity class methods to create a text/html body for the document you are creating. This answer to another question on StackOverflow suggests using Word automation for the conversion, but you may want to do a more thorough review of search on 'convert rtf to html' to see if you can come up with anything better.