In VB I've used the following to be able to search from the cursor to the end of a story.
Set SChar = Ind.Selection(1).ParentStory.Characters(Ind.Selection(1).InsertionPoints(-1).Index)
Set EChar = Ind.Selection(1).ParentStory.Characters(-1)
Set SrchTxt = Ind.Selection(1).ParentStory.Texts.ItemByRange(SChar, EChar)
I was assuming I would be able to also iterate through SrchTxt.Paragraphs but whatever type of object SrchTxt ends up being it doesn't have "Paragraphs" as a property.
I want to interate through part of the story by paragraph and based on certain criteria, one of them being the style applied to the paragraph, stop so the user can take action.
How do I reference only part of a story, or figure out in which paragraph within a story the cursor is planted when the script starts?
Thanks very much,
Set SrchTxt = Ind.Selection(1).ParentStory.Texts.ItemByRange(SChar,
Texts is a collection of one Text object. You need to reference the
first item of the collection.
Innovations in Automation
Like Harbs said - you need to refer to first item of the result of ItemByRange.
And you aren't limited to Characters as params - in .Texts.ItemByRange(start,end) - you can use any text object as start, end - InsertionPoint, Character, Word, etc. - but you can't use numbers - Text is only one per each text item
If you need to refer to "current" paragraph:
Set myCurPara = myInDi.Selection.Item(1).Paragraphs.Item(1)
OY! I Forgot about using the .item.
Thanks very much guys!