View Single Post
 
Old 02-04-2024, 08:31 AM
ctviggen ctviggen is offline Windows 10 Office 2016
Advanced Beginner
 
Join Date: Feb 2021
Posts: 54
ctviggen is on a distinguished road
Default

I figured it out, using a brute force method. I first re-ran the code by Chat GPT, but that was wrong. So, I looked at other code of mine and just went line by line through this, changing coding as necessary and running 10+ times, until I got what I wanted. Not pretty, but works.


Code:
newDoc.paragraphs(1).Range.InsertBefore Text:="Para1" & vbCr & vbCr
    newDoc.paragraphs(2).Style = "StyleB"
    newDoc.paragraphs(2).Range.InsertAfter Text:="Para2" & vbCr & vbCr
    newDoc.paragraphs(4).Style = "StyleB"
    newDoc.paragraphs(4).Range.InsertAfter Text:="Para3" & vbCr & vbCr
    newDoc.paragraphs(6).Style = "StyleB"
Reply With Quote