It is run from Excel VBA to Word and opens specified Word documents. Then the code locates InlineShapes in Word and attempts to get the heading above the shape and use its text to update the Shapes' Alternative Text. The routine I'm missing is: Call GetPrevHeadingLevel
This attempt here (code below) actually uses the InlineShape page number and matches it with the TOC page number. When they are equal I grab the TOC text for that page number and slap it on the Alt Text for the InlineShape. And it works. The problem is there isn't any consistency in how the Word doc's are laid out when it comes to Headings. In other words, some pages may have 2 or more InlineShapes with only one Heading 1 above. It's not a one-to-one where each InlineShape has it's own Heading. If that were the case I could go with this approach.
The most sure fire approach is to locate the Inlineshape first (which I have) ; and then get the first previous Heading from above. That would solve my problems.
It seems really like I'm asking a very basic EXCEL question but I'm not getting a response on ANY message board. I'm certain that I'm missing a very basic principle or fundamental feature in Excel VBA that moves you to the previous Heading from a location (InlineShape) you're already at. I'm asking how do you get from point A to point B on the SAME page and no one has been able to tell me how to do it.
Oh, BTW if you haven't already guessed I'm not Steve McQueen Macro Man. I'm a learning hack like a lot of folks out there and most of my learning has been taking over maintenance of such doc's and tech sites like this one.
Bookmarks