it's not something as simple as the index starting with 0, is it?
No, it works perfectly with the other textframes, that contains only 1 paragraph, and docTF.Paragraphs(paraNb) with paraNb=1 causes no error. On another file, where a textframe includes 8 paragraphs, there was no error either, that's why I don't understand why I get this error...
My bad, should have thought about it in the first place. I copied my post there.
i would guess there is something about that text frame that has illy confused.
if you copy the text to a notepad app. then draw a new text frame and re copy and paste the text back in to illy does it still wig out on the same frame?
after that i would be trying to see if there is something strange in the formatting, special chars or something. maybe add a 3rd parragraph. and or remove the gap between 1 and 2 combining them into 1 parragraph. at each stage query the dom to see whats going on.
Once again, my bad, I should also have posted my answer here, and not only in my other post...
The problem was with variable types: I was casting my variable paraNb as an Integer, when Paragraphs() requires a Double.
As long as paraNb value was 1, it was still OK, but as soon as it got to 2, Illustrator couldn't take it as a Double, it was obviously an Integer.
The issue here should have been reported as wrong type, which would have pointed me in the right direction from the start, but Illustrator reported it as though Paragraphs(Int) is an unknown element (when Paragraphs(Dbl) isn't)...
Anyway, I corrected my cast in paraNb = CDbl(Para) and haven't had any issue with it ever since.
thanks for posting back your results.