View Single Post
 
Old 04-18-2017, 11:17 AM
Tye30 Tye30 is offline Windows 7 32bit Office 2010 32bit
Novice
 
Join Date: Apr 2017
Posts: 7
Tye30 is on a distinguished road
Default

Hello macropod,

Thank you for responding to my question! This is what I came up with from your suggestion

Code:
 
Sub TEST_REVISE()
'
'
    Selection.HomeKey Unit:=wdLine
 
    With Selection.Find
        .Replacement.ClearFormatting
        .Text = "^p    |Z| "
        .Replacement.Text = "^pZR"
        .MatchWildcards = False
        .Execute Replace:=wdReplaceOne, Forward:=True, Wrap:=wdFindContinue
    End With
    With Selection.Find
        .Replacement.ClearFormatting
        .Text = "|"
        .Replacement.Text = ""
        .Execute Replace:=wdReplaceOne
    End With
 
        Do While Selection.Find.Found = True And iCount < 13
        iCount = iCount + 1
            With Selection.Find: .Execute Replace:=wdReplaceOne, ReplaceWith:="", _
                     Forward:=True: End With
            'myNumber = myNumber + 1
 
        Loop
 
    Selection.MoveDown Unit:=wdLine, Count:=1
    Selection.HomeKey Unit:=wdLine
 
End Sub
When I run the macro it doesn't actually find the first instant of "^p |Z| " it will skip the line the cursor is on and actually find the line below it. Also, it runs a bit slower at about 26 seconds to execute 100 times vs 3 seconds to execute 100 times.
Reply With Quote