Hi,
I have a richtext field Body , and I want to put in Dear Firstname Lastname , following some text messagage in next few lines
Here is my code,
Evereything works fine except in the Body Field ,
My lastname comes below the Dear and the Firstname
I cannot figure out why this is happening …
Dim session As New notessession
Dim workspace As New NotesUIWorkspace
Dim db As NotesDatabase
Dim dt1 As New NotesDateTime(Now)
Dim ws As New NotesUIWorkspace
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Dim doc3 As NotesUIDocument
Dim doc4 As NotesDocument
Dim contview As NotesView
Dim contdoc As NotesDocument
Dim bodyitem As NotesRichTextItem
Dim strname As String
Set db=session.currentdatabase
Set uidoc = workspace.CurrentDocument
Set doc=uidoc.document
Set contview = db.GetView("(Admin View)")
Set contdoc = contview.getFirstDocument
currentname=doc.cnctemail(0)
If uidoc.IsNewDoc Then
Messagebox _
( "Please save the document before forwarding it.")
Exit Sub
End If
If currentname="" Then
Msgbox "There was no Customer Email listed on the call log form. You will have to type it in the TO field", _
MB_ICONINFORMATION,"Missing Customer email"
End If
Dim contitem As NotesRichTextItem
Set contitem = contdoc.GetFirstItem("contBody")
Dim newdb As New NotesDatabase(contdoc.contServerName(0), contdoc.contDatabasePath(0))
If doc.cnctname_1(0) = "" Then
strname = Trim$(Replace(doc.cnctname(0), Chr$(13), ""))
Else
strname = Trim$(Replace(doc.cnctname_1(0), Chr$(13), ""))
End If
Dim strfname As String
strfname= Strleft(strname, " ")
Dim strlname As String
strlname = Strright(strname, " ")
strname = strfname + " " + strlname
Dim maildoc As New notesdocument(newdb)
Set bodyitem = New NotesRichTextItem( maildoc,"Body" )
maildoc.Form = "Memo"
maildoc.SendTo = currentname
maildoc.EnterSendTo = SendTo
bodyitem.AppendText(“Dear” + " " + Replace(strname, Chr$(13),“”))
bodyitem.AddNewLine(2)
bodyitem.AppendText("Thank You for your email")
bodyitem.AddNewLine(2)
bodyitem.AppendText(Cstr(doc.IncidentDescription(0)))
maildoc.send(False)
End Sub
Please help,
Thanks
ac ac