View Single Post
 
Old 10-06-2023, 01:00 AM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi, RobiNew! I think I've got your point! Without my explanations, try the following. If it is what you want, I will explain the logic later, if not, I'll save your and my time:
Code:
Sub X()

Dim oRng As range
Dim iType As Integer
  For iType = 1 To 2
    Set oRng = ActiveDocument.StoryRanges(iType)
    With oRng.Find
       .ClearFormatting
       .Replacement.ClearFormatting
       .text = "^w^p"
       .Replacement.text = "^p"
       .MatchWildcards = False
       .Execute Replace:=wdReplaceAll
    End With
  Next iType
  Set oRng = ActiveDocument.StoryRanges(2)
    With oRng.Find
       .ClearFormatting
       .Replacement.ClearFormatting
       .text = "^p^p"
       .Replacement.text = "^v"
       .MatchWildcards = False
       .Execute Replace:=wdReplaceAll
       .text = "^v"
       .Replacement.text = ""
       .Execute Replace:=wdReplaceAll
    End With
 Set oRng = Nothing
End Sub
Reply With Quote