Let me dive straight into the point. Assume that I have few document say five documents with a rich text item in each one of it and all of them are created using same form. So don’t bother about minor variations like missing document items etc… To make things simple let me say that these five documents are design equivalent.
Now let me say that I don’t put any values inside the richtext field in 3 document alone. So on the contrary I have values on all the 4 remaining documents.
Now assume that I have the following sort of code in an agent
On Error Goto errhandler
Set richStyle = session.CreateRichTextStyle
richStyle.PassThruHTML = true
While Not doc Is Nothing
Call richText.BeginInsert(rtNav) ---------------------à>> when itr=3 this line will error out with error number 4506
'Call rtnav.GetLastElement(RTELEM_TYPE_TEXTRUN )
'Call doc.Save(True, False)
Print Cstr(itr) & " doc processed"
If Err=4506 Then Goto skiploop
Print Error & " *** occured on line *** " & Cstr(Erl) &"*** with error number *** " & Cstr(Err)
As you may understand the since the rich text field in the third document is empty an error with number 4506 will occur.
You can say that one can handle this scenario by using some thing like “IF rtnav Is Nothing Then goto SkipLoop” etc… but it did not work so I managed to loop the control back in my error handler section.
And guess what, the object rtnav becomes unusable. I simply does not set any right values the next time the loop executes and does not accept any values. And so the following error occurs
And alas… the code breaks. Complier does not even make it to the error handler.
So sad L
I think I know a work around for that. So stay tuned