[ create a new paste ] login | about

Link: http://codepad.org/sZEG78ak    [ raw code | fork ]

Plain Text, pasted on Feb 21:
    Option Explicit
    Sub replaceArrayForArray1()
    '
    'to create array use prefix\suffix and replacing tool http://textmechanic.com/
    '
    '
    findArray = Array("[1]", "[2]", "[3]")
    replArray = Array("@@@[1]@@@", "@@@[2]@@@", "@@@[3]@@@")

    For i = 0 To UBound(findArray)
        Selection.Find.ClearFormatting
        Selection.Find.Replacement.ClearFormatting
        With Selection.Find
            .Text = findArray(i)
            .Replacement.Text = replArray(i)
            .Forward = True
            .Wrap = wdFindContinue
            .Format = False
            .MatchCase = True
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
        End With
        Selection.Find.Execute replace:=wdReplaceAll
    Next i
    End Sub

    Sub replaceArrayForArray2()
    '
    'to create array use prefix\suffix and replacing tool http://textmechanic.com/
    '
    '
    findArray = Array("@@@[1]@@@", "@@@[2]@@@", "@@@[3]@@@")
    replArray = Array("[11]", "[12]", "[13]")

    For i = 0 To UBound(findArray)
        Selection.Find.ClearFormatting
        Selection.Find.Replacement.ClearFormatting
        With Selection.Find
            .Text = findArray(i)
            .Replacement.Text = replArray(i)
            .Forward = True
            .Wrap = wdFindContinue
            .Format = False
            .MatchCase = True
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
        End With
        Selection.Find.Execute replace:=wdReplaceAll
    Next i
    End Sub


Create a new paste based on this one


Comments: