Word Macro to FIND --> GO TO A CERTAIN NUMBER and COPY AND PASTE THAT NUMBER

  • Hi Guys,


    Need help in creating a Macro with word.


    I want it to FIND for a certain phrase, say


    ??,???.?? AWT


    once found, cut and paste this phrase, then reverse find:


    054-?????-??


    and cut and paste this phrase beside it.


    The phrase will always start with 054.


    Anyone can help on this?

  • Re: Word Macro to FIND --> GO TO A CERTAIN NUMBER and COPY AND PASTE THAT NUMBER


    Hi,


    Use the macro recorder I was able to generate this code in word 2003.[vba]Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 9/2/2005 by Andy Pope
    '
    With Selection
    .Find.ClearFormatting
    With .Find
    .Text = "??,???.?? AWT"
    .Replacement.Text = ""
    .Forward = True
    .Format = False
    .MatchWildcards = True
    .Execute
    End With
    Selection.Cut
    .Find.ClearFormatting
    With Selection.Find
    .Text = "054-??????-??"
    .Replacement.Text = ""
    .Forward = False
    .Wrap = wdFindAsk
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchAllWordForms = False
    .MatchSoundsLike = False
    .MatchWildcards = True
    .Execute
    End With
    Selection.MoveLeft Unit:=wdCharacter, Count:=1
    Selection.PasteAndFormat (wdPasteDefault)
    End With
    End Sub[/vba]
    If this doesn't work maybe you can post an example doc.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!