PDA

View Full Version : Solved: StoryRanges Object



qazpl
12-03-2006, 07:51 AM
I have a 20 page Document that also has footnotes, endnotes and many TextBoxes (Insert=>Textbox). Every Page has 2 Unlinked TextBoxes and 2 TextBoxes that are linked through the whole Document. I want to search through all the text in the whole doc, so I tried using the storyRanges Collection. for example,

For each astory in activeDocument.StoryRanges
.........(Search Info).........
Next aStory

what happens is that is scrolls through the maintext, endnotes, footnotes and some other stuff but only includes 1 unlinked TextBox on first Page of Doc. Why is that, and is there any other way to get it all without going from shape to shape.

I tested by sticking in macro
aStory.Select
and by watching in watch debugger window the storyType
and only one TextBox was selected

qazpl
12-03-2006, 01:52 PM
I think I got it. StoryRanges only includes the first of each StoryType. For the rest of the stories it's neccesary to use NextStoryRange Method.
See article http://word.mvps.org/FAQs/Customization/ReplaceAnywhere.htm for more info. Thanks

fumei
12-03-2006, 08:17 PM
Thank you for following up your own post. Excellent! That is what we like to see.

And yes, that only-look-in-the-first-object is a real pain.