Help with reading table in a richtext field

Hi,

I am designing an agent to intercept certain particular incoming mails, reading a table in the richtext Body field, getting its number of rows then processing data to be sent to a group of users. I use this set of code from Lotus Domino Designer 7 to read row count of the table. It works fine in detecting the existence of a table in the Body field but can NOT read table’s number of rows/columns:

Sub Initialize

Dim session As New NotesSession

Dim db As NotesDatabase

Set db = session.CurrentDatabase

Dim dc As NotesDocumentCollection

Set dc = db.UnprocessedDocuments

Dim doc As NotesDocument

Set doc = dc.GetFirstDocument

totalrow = 0

Dim rti As NotesRichTextItem

Set rti = doc.GetFirstItem("Body")

Dim rtnav As NotesRichTextNavigator

Set rtnav = rti.CreateNavigator

If Not rtnav.FindFirstElement(RTELEM_TYPE_TABLE) Then

	Messagebox "Body item does not contain a table",, "Error"

	Exit Sub

End If

Dim rtt As NotesRichTextTable

'Call doc.Save(True,True)

Set rtt = rtnav.GetElement

Dim rowcount As Long

Dim columnCount As Long

rowcount = 0

rowcount = rtt.RowCount

Columncount =rtt.ColumnCount

Msgbox rowcount,,"Rowcount"

End Sub

If I edit & save the intended mail then this piece of code can spit out for me the count of row and column?!?! There are much more code for this agent but it stuck right at this function where I temporarily set as an Action Button to test the code. I ran this piece of code in debug mode it’s true that it does not see row nor column of the table.

Please help! What do I need to do? Many, many thanks in advance.

Subject: RE: Help with reading table in a richtext field

If I am understanding correctly that you are running this for testing in a document that is open for editing, then you should be aware that the NotesRichTextItem value in the back end does not reflect the value entered in the UI until the document has either been saved, or you use NotesUIDocument.Refresh(True).