Forum Discussion

JulianAguilar's avatar
JulianAguilar
Copper Contributor
Mar 03, 2023

CARET CODE FOR SECTION BRAKE NEXT PAGE

I was trying to format a document using "search and replace", however when trying to replace "section brake next page" I find out that is not listed and I was not able to find the caret code after googling it. Can someone please help? 

1 Reply

  • JulianAguilar Assuming that you want to replace manual page breaks with Next Page Section Breaks, you will need to use code such as

    With Selection
        .HomeKey wdStory
        With .Find
        Do While .Execute(FindText:="^m", Forward:=True, MatchWildcards:=False, Wrap:=wdFindStop) = True
            ActiveDocument.Sections.Add Selection.Range
            Selection.Collapse wdCollapseEnd
            Selection.MoveStart wdCharacter, -1
            Selection.Delete
        Loop
        End With
    End With

    **bleep** 

Resources