Text not formatting properly

Hi All, I am getting value from excel sheet and creating new doc and sending mail to user , the problem is the text is not formatting properly , any clue why the body field is not formatting properly

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim logdoc As NotesDocument

Set db = session.currentdatabase

Dim arrayOfRecs() As RecType

Dim txt As String

Dim fileNum As Integer

Dim counter As Integer

Dim countRec As Integer

Dim Manudoc As NotesDocument

Dim Busidoc As NotesDocument

Dim PQdoc As NotesDocument

Dim strValue1 As String

Dim strValue2 As String

Dim strValue3 As String

Dim strValue4 As String

Dim strValue5 As String

Dim strValue6 As String

Dim strValue7 As Variant

Dim strValue8 As String

Dim strValue9 As String

Dim strValue10 As String

Dim strValue11 As String

Dim strValue12 As String

Dim AFdoc As NotesDocument

Dim view As NotesView

Dim body1 As NotesRichTextItem

Dim body2 As NotesRichTextItem

Dim body3 As NotesRichTextItem

Dim body4 As NotesRichTextItem

Set view = db.GetView("Group")

''

Set varXLFile = CreateObject("Excel.Application")

varXLFile.Visible = False

Set varXLWorkbook = Nothing

'Prompt for the name of the file and try to open it

strXLFilename = "C:\Documents and Settings\ssubramani45\Desktop\TTTS_Reports"

varXLFile.Workbooks.Open strXLFilename

Set varXLWorkbook = varXLFile.ActiveWorkbook

Set varXLSheet = varXLWorkbook.ActiveSheet

Dim rtitem As Variant

'Loop through all valid rows and call the

lngRow =3

While Not (varXLSheet.Cells(lngRow, 1).Value = "")

	strValue = varXLSheet.Cells(1, 1).Value

	strValue0 = Format(strValue,"dd:mm:yyyy:h:mm:ss")

	strValue1 = varXLSheet.Cells(lngRow, 1).Value

	strValue2 = varXLSheet.Cells(lngRow, 2).Value

	strValue3 = varXLSheet.Cells(lngRow, 3).Value

	'strValue4 = "Sub Poftfolio"

	'strValue4 = varXLSheet.Cells(lngRow, 4).Value

	'strValue5 = varXLSheet.Cells(lngRow, 5).Value

	strValue6 = varXLSheet.Cells(lngRow, 6).Value

	strValue7 = varXLSheet.Cells(lngRow, 7).Value

	strValue8 = varXLSheet.Cells(lngRow, 8).Value

	strValue9 = varXLSheet.Cells(lngRow, 9).Value

	strValue10 = varXLSheet.Cells(lngRow, 10).Value

	strValue11= varXLSheet.Cells(lngRow, 11).Value

	Set doc = view.GetDocumentBykey(Trim(strValue3))

	If Not doc Is Nothing Then

		If Trim(doc.portfolio(0)) ="Manufacturing"  Then

			If Manudoc Is Nothing Then

				Set Manudoc = New NotesDocument(db)

				Manudoc.Form = "Memo"

				Manudoc.Subject = "Manufacturing - Open tickets as on "+strValue0

				Set body = New NotesRichTextItem(Manudoc, "Body")

				tx = "Ticket" +" "+ "Catgy"+ " "+"Org"+ " "+"Sub PortFolio" +" "+"Prob Date"+ " "+"Prob Time"+ " "+"Route Date"+ "Route Time"+" "+"Ack Date"+" "+"Ack Time"

				

				Call body.AppendText(" Following are the open tickets as on" + strValue0 )					

				Call body.addnewline(1)

				Call body.AppendText(tx)

				portfolio = "Manufacturing"

				Manudoc.Sendto = "ss1400@chrysler.com"

				Call Manudoc.Save(True, False)

			Else

				Set rtitem = Manudoc.GetFirstItem( "Body" )

				If ( rtitem.Type = RICHTEXT ) Then

					Call rtitem.AddNewLine( 1 )

				'	Msgbox Format(strValue7,"h:mm:ss")

					strValue4 = doc.Subport(0)

					ttx = strValue1+"  "+ strValue2+"  "+ strValue3+"  "+ strValue4+"  "+ strValue6+"  "+ Format(strValue7,"h:mm:ss")+"  "+ strValue8+"  "+ Format(strValue9,"h:mm:ss")+"  "+ strValue10+"  "+ Format(strValue11,"h:mm:ss")

					Call rtitem.AppendText(ttx)

					portfolio = "Manufacturing"

				'	Call rtitem.GetFormattedText( False, 0 )

					Call Manudoc.Save(True, False)

				End If			

			End If

		

If Not Manudoc Is Nothing Then

	Set rtitem = Manudoc.GetFirstItem( "Body" )

	Call rtitem.AddNewLine( 1 )

	Manudoc.tmpDisplaySentBy ="TTTS"

	Call rtitem.AppendText("This is auto generated Mail please do not reply")

'	Manudoc.Principal= "TTTS open reports"

'	Manudoc.DisplaySent= "TTTS open reports"

	Call Manudoc.save(True,False)

	Call Manudoc.Send( False )

	Call Manudoc.remove(True)

End If

End Sub

and also nice if i get any clue to create table and put the values in the table and send mail

Subject: text not formatting properly

It’s not formatting properly because you’ve done something wrong. But because you don’t say what it is doing, exactly, and what you wanted it to do, there’s no way to tell exactly what the problem is. I’m not even sure what you mean by “formatting” – the contents of the text, or the font and paragraph styles (in the latter case, the answer is the formatting is wrong because you haven’t used any formatting methods, so you just get the default style).

Incidentally, are the values in strValue3 unique? If not, this is fairly inefficient code – you might want to work on your algorithm to avoid having to look up the same key and save the same document multiple times. Rich text that you add onto and save repeatedly gets fragmented, and needs to be compacted.