VBA WORD: Remove double paragraph marks

后端 未结 3 1924
暖寄归人
暖寄归人 2020-12-20 06:38

Trying to move excessive paragraph gaps via this procedure.

Sub RemoveGaps()
    wrdDoc.Content.Select

    Selection.Find.ClearFormatting
    Selection.Find         


        
3条回答
  •  误落风尘
    2020-12-20 06:49

    You don't need to fire whole sub but go back few lines like this:

    Sub RemoveGaps()
    Dim wrdDoc As Document
    Set wrdDoc = ActiveDocument
        wrdDoc.Content.Select
    
        Selection.Find.ClearFormatting
        Selection.Find.Replacement.ClearFormatting
    
        With Selection.Find
            'oryginal
            .Text = "^13^13"
            .Replacement.Text = "^p"
            .Forward = True
    
        End With
    
    GoHere:
        Selection.Find.Execute Replace:=wdReplaceAll
    
        If Selection.Find.Execute = True Then
            GoTo GoHere
        End If
    
    End Sub
    

    I tested it and it works fine with my Word 2010.

提交回复
热议问题