Hello!
I am having trouble finding the right VBA code for the following:
I work with draft documents on Word that have several consecutive paragraphs. At the end of the document, there are several more individual lines with time stamps.
The lines with the time stamps can look like this:
- There is a time stamp followed by some italic text. This line forms a section.
- There is a time stamp followed by some text in bold. After the bold text, there is a line of italic text. These two lines form a section that is independent of the other section.
So each time stamp initiates its own time stamp section. The next time stamp section starts with the next time stamp.
You can see an example of how this document can look like in the Word doc attached ('Example text_rough'). The words 'Text' are meant as a placeholder for actual sentences. The 'XX:XX' are the time stamps. I highlighted the lines with the time stamps in yellow so you can distinguish. The actual documents I work with don't have yellow highlights.
I then rearrange the paragraphs so that each time stamp section introduces two paragraphs. So first you have time stamp section 1 and then paragraphs 1 and 2 below. Then you have time stamp section 2 and then paragraphs 3 and 4 below. This continues until the last time stamp is at the end. You can see the new arrangement in the attached Word doc called 'Example text_arranged'.
What I want is to have a macro that automates these steps, rearranging the time stamp sections and the paragraph sections. The documents I work with can have different lengths of paragraphs and the time stamp sections can also look different than in the docs attached. Sometimes there are several consecutive time stamp sections that have only one line, sometimes there are also several consecutive time stamp sections that have more than one line. But what always stays the same is that one time stamp section ends when the next time stamp shows up, as this next time stamp initiates the next time stamp section.
Thank you for helping me out on this. I think it is a very specific issue but I can imagine that there is a way to automate this process. I tried to find a way using ChatGPT but the solutions it offered weren't working as I often got error messages.
Thanks!