I have a form in our sales force automation system within Lotus Notes that is used to send our customers letters. The form creates/embeds a MS WORD document into the form, which works great. However, I need to create a letter library where the users can enter the standard body of the letters which can then be pulled into the WORD letter. This is working except that the RichText formatting from the letter library form is ignored and only text is being added to the WORD document. Is this possible to do? If so, does anyone have any examples?
Below is my code that is used to create and populate the embedded WORD document. The code that is used to add the body of letter is variables ‘Template’, ‘tempdb’, ‘tempview’ and ‘tempdoc’.
Thank you in advanced for any help you may be able to provide.
Sub Postopen(Source As Notesuidocument)
’ Set variables
’ Used to get Letter Template from library
Dim tempdb As NotesDatabase
Dim tempdoc As NotesDocument
Dim tempview As NotesView
Dim Template As Variant
'-------------------------------------------------------
...........
'Check if new document, if yes create new word doc, if not open from document
If Source.IsNewDoc Then
'Copy Letter from template to c:\temp\temp.doc and then attach to new document
Setup code .......
Template = workspace.Prompt (PROMPT_YESNO, _
"New Correspondence Selection", "Do you want to use a template for this correspondence?")
If Template = 1 Then
Template = workspace.PickListStrings( _
PICKLIST_CUSTOM, _
False, _
server, _
"CMLib", _
"LTemp", _
"Letter Library", _
"Please select template to be used.", _
"1" )
End If
' Get handle on template to be used for body of letter
Set tempdb = session.GetDatabase ( wserver, "XYZLib.nsf" )
Set tempview = tempdb.getView("LTemp")
Set tempdoc = tempview.GetDocumentByKey(Template(0),True)
'Populate variables with info to pass to word and update the variables in Word document
Formal = Trim(Source.fieldgettext("Formal") )
.........
' Set varibales in word document
.........
>>>>>> WordObj.variables("Body").value = tempdoc.Body
'Activate Word, add a window for the new document and show the application
..........
End If
End Sub