Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 07-23-2024, 03:16 AM
Santiago H. Santiago H. is offline Help needed: Word macro to rearrange paragraphs Windows 10 Help needed: Word macro to rearrange paragraphs Office 2019
Novice
Help needed: Word macro to rearrange paragraphs
 
Join Date: Jul 2024
Posts: 4
Santiago H. is on a distinguished road
Default Help needed: Word macro to rearrange paragraphs

(I have also posted this here: Word macro to rearrange paragraphs)



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!
Attached Files
File Type: docx Example text_rough.docx (13.8 KB, 5 views)
File Type: docx Example text_arranged.docx (13.8 KB, 5 views)

Last edited by Santiago H.; 07-24-2024 at 02:52 AM.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with word macro to duplicate paragraphs in word document baidu0021 Word VBA 4 07-06-2022 04:58 AM
Help needed: Word macro to rearrange paragraphs Word VBA Macro Needed to Crop & Resize Pictures Alex Cheng Word VBA 5 10-04-2021 11:15 AM
Macro Needed to delete Unwanted paragraphs within a table. frustrated teacher Word VBA 0 06-05-2015 12:47 PM
Help needed: Word macro to rearrange paragraphs Macro Needed to delete Unwanted paragraphs in series frustrated teacher Word VBA 1 05-02-2014 03:32 PM
Rearrange Mailing List Data gijoe985 Excel 17 08-01-2013 07:55 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft