View Single Post
 
Old 06-24-2017, 08:20 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

The macro doesn't remove an empty paragraph at the end of the document, but that's easily fixed

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
'Graham Mayor - http://www.gmayor.com - Last updated - 25 Jun 2017
Dim oRng As Range
    Set oRng = ActiveDocument.Range
    With oRng.Find
        .Text = "^13{2;}" 'Note the list separator character - here ;
        .Replacement.Text = "^p"
        .MatchWildcards = True
        .Execute Replace:=wdReplaceAll
    End With
    If Len(ActiveDocument.Range.Paragraphs.Last.Range) = 1 Then
        ActiveDocument.Range.Paragraphs.Last.Range.Delete
    End If
lbl_Exit:
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote