Reputation: 5472
In MS Word I need to string replace a pattern ($$$newpage
) with a page break. Is this possible with standard page search? Or do I need to do it programmatically?
Upvotes: 6
Views: 18681
Reputation: 235
I had same problem but my need is to replace Section Break "^b" with page break "^m". Find and replaxce doesn't work for me. I resolved using this VBA script:
Sub ReplaceSectionBreaks()
'reliably replace section breaks with page breaks
'even if they're followed by tables
Dim rg As Range
Set rg = ActiveDocument.Range
With rg.Find
.Text = "^b"
.Wrap = wdFindStop
While .Execute
rg.Delete
rg.InsertBreak Type:=wdPageBreak
rg.Collapse wdCollapseEnd
Wend
End With
End Sub
try to change "^b" with your pattern "$$$newpage", it should to work for you too.
Upvotes: 1
Reputation: 53535
go to "find and replace" and enter your "find" character and replace it with ^m
You can read more about it here
Upvotes: 11