View Single Post
 
Old 01-21-2024, 09:21 PM
tonykekw tonykekw is offline Windows 11 Office 2021
Novice
 
Join Date: Jan 2024
Posts: 13
tonykekw is on a distinguished road
Unhappy Finding,Sorting and creating a new Section VBA Script help

Hello again, I have a new question, and I haven't found something similar to my problem at hand yet.

What I would like to do is find a value (for e.g., [red]) within my document. Just how the built-in Navigation pane does. This is because I have many "tags" at the end of sentences and/or paragraphs that end with such "tags".

Then I would like to essentially grab the entire sentence/paragraph that comes before the "tags" along with the tag itself.

For example, Adam ate an apple.[Red]

I look up the "tag" [Red], and I pull that entire sentence before it along with the tag.

If possible, I would also like to have the heading level name with it. The document uses many of the MS Word built-in heading levels to organize the document.

I have managed to write some scripts that try to do what I want, but they time out or I have an error.

The reason I would like to do this is so that the reader can only read what they want to read. Such as if they only want to read the tag [blue] or #triangle. They can just click on a section of the document that says "[blue] documentation.

I know this is confusing and very long and specific, but I have been working on trying to figure this one out myself for about a month before asking for help. I would provide my code snippets, but they don't work, and I did use ChatGPT to help me with them. Save myself the embarrassment.
Reply With Quote