Create navigator

Hello,

I am trying to use CreateNavigator but there is an error.

Can you help me ?

Here is the code

Dim doc As NotesDocument

Dim rti As NotesRichTextItem

Dim rtnav As NotesRichTextNavigator

Dim rtlink As NotesRichTextDocLink

Set rti = doc.GetFirstItem( result )

Set rtnav = rti.CreateNavigator

Do

Set rtlink = rtnav.GetElement

attach_name = attach_name + Chr(10) + rtlink.DisplayComment

Loop While rtnav.FindNextElement

Subject: Create navigator

Your code appears to assume that the rich text element it finds at the current position is going to be a doclink. I’m guessing that’s where your code goes wrong, but without more detail it is just a guess – for example, for all I know your script can’t even create the navigator object. What about the debugger?

Also, what’s “result”? Are you sure it’s instantiated? As expressed in your script it’s a variable, but if you’re looking to actually find a field called “result” then your code is wrong. It should read:

Set rti = doc.GetFirstItem("result")

Set rtnav = rti.CreateNavigator

Subject: RE: Create navigator

Hello,

In this form I have several rich text fields (result1, result2, …, result8) some of them can have or not doclinks.

In this example and when I am debugging, the first field “result1” have a doclink and an attachment. Attachment name is printed but an error appears “position is not valid” when it reaches the code for doclink, I can send you all code if you need.

Thanks

Subject: RE: Create navigator

OK !!!

I found it

If rtnav.FindFirstElement(RTELEM_TYPE_DOCLINK) Then

Do

Set rtlink = rtnav.GetElement

attach_name = attach_name + Chr(10) + rtlink.DisplayComment

Loop While rtnav.FindNextElement

End If

Thanks for you hint