View Single Post
 
Old 12-28-2021, 02:01 PM
RMittelman RMittelman is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2010
Posts: 19
RMittelman is on a distinguished road
Default

Hi GMayor,

I'm playing with your code, and I'm confused by something.

The code loops through the story ranges, only processing types 1 - 11. That I understand. If the story type is 6 - 11 (headers & footers), it process them again if they have a shape range count >0. Also, they only process if they have a TextFrame with .HasText true. I presume these are text boxes in the headers/footers, and you want to replace text in those text boxes.

So this brings up 2 questions:
1: What if there are text boxes NOT in a header or footer? This seems to ignore that possibility.

2: The code sends the oStory object to the subroutine, but that was already done before, right? If you want to replace text in the text box(es), shouldn't you be sending the text box range to the subroutine instead of the oStory range, which has already been processed? If this is so, what object should you send the second time? I can't seem to find a text range object in the Word object model under StoryRanges or ShapeRange.TextFrame. Do you have any ideas on this?

Please forgive if my understanding of your code is faulty.

Thanks...

P.S. I've been using a simplified version which loops through each StoryRange and does the find and replace without worrying about shapes. Seems to work fine, but I'm curious about your code.
Reply With Quote