Is there more beautiful way to get reference for next para?

I have insertion point in some paragraph.
Now i need to know para style of some next paras.
I use this huge construction:
Set mPara0 = myInd.Selection.Item(1).Paragraphs.Item(1) 'para inder  cursor
Set mPara3 = mPara0.InsertionPoints.Item(-1).Paragraphs.Item(1) 'third para
Set mPara3 = mPara3.InsertionPoints.Item(-1).Paragraphs.Item(1)
Set mPara5 = mPara3.InsertionPoints.Item(-1).Paragraphs.Item(1) 'fifth para
Set mPara5 = mPara5.InsertionPoints.Item(-1).Paragraphs.Item(1)
ParaName3 = mPara3.Paragraphs.Item(1).AppliedParagraphStyle.Name
ParaName5 = mPara5.Paragraphs.Item(1).AppliedParagraphStyle.Name
Is there some other way?
Thanks.

I'd like very much to compare speed, but couldn't use "index" property.
This line wrote err:
Set ParaName3 = myInd.Selection.ParentTextFrames.Item(1).Paragraphs.Index(mIndex + 2)
cause "index" property is inside item with some number in parent obj, which number i do not know. Or i have to check every item, and compare its index number with current para (i think it's enough stupid way). Give a hint, pls.
because there is no .Index(mIndex + 2) function
if you want to refer to Nth paragraph - you need to use .Paragraphs.Item(mIndex + 2) or just .Paragraphs(mIndex + 2)
and I think getting NextParagraph by refering to last InsertionPoint in current is the best method
and you can't refer to next paragraph by increasing current pargraph's index
if you will write:
mIndex = myPara.Index
and you will then try to write
Set myNextPara = myStory.Paragraphs.Item(mIndex + 1)
this will not return next paragraph - it will return paragraph with index of first character from mIndex paragraph + 1
robin
www.adobescripts.co.uk

Similar Messages

Maybe you are looking for