Notes RichText Section

I need to extract the content of a section in a richtext field. I have written the code as below , but not sure somehow its loops through the entire richtext field , instead of reading only the section content . can anyone suggest me where would be the mistake.

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Set db = session.CurrentDatabase

Set view = db.GetView(“Documents”)

Dim doc As NotesDocument

Set doc = view.GetFirstDocument

Dim rti As NotesRichTextItem

Set rti = doc.GetFirstItem(“Docattachment”)

Dim rtnav As NotesRichTextNavigator

Dim rtsecpara As NotesRichTextNavigator

Dim rtrangesec As NotesRichTextRange

Dim rtrangepara As NotesRichTextRange

Dim rtnavsec As NotesRichTextNavigator

Dim rtnavFlag As Variant

Set rtnav = rti.CreateNavigator

Set rtsecpara = rti.CreateNavigator

If Not rtnav.FindFirstElement(RTELEM_TYPE_SECTION) Then

Messagebox “Body item does not contain a section,”, _ “Error”

Exit Sub

End If

Dim rts As NotesRichTextSection

Set rtrangesec = rti.CreateRange

Do

Call rtrangesec.SetBegin(rtnav)

Call rtrangesec.SetEnd(rtnav)

Set rts = rtnav.GetElement

Messagebox rts.Title

Set rtrangepara = rti.CreateRange

Call rtsecpara.FindFirstElement(RTELEM_TYPE_TEXTPARAGRAPH)

Do

Call rtrangepara.SetBegin(rtsecpara)

Messagebox rtrangepara.TextParagraph 

Call rtrangepara.SetEnd(rtsecpara)

Loop While rtsecpara.FindNextElement(RTELEM_TYPE_TEXTPARAGRAPH)

Loop While rtnav.FindNextElement(RTELEM_TYPE_SECTION)

Thanks in advance

Subject: Looping through the section content

How do we loop through the content in a Section , Using the program i am getting handle only to a Firstparagraph…