Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    problems with macros (MS Word 2002)

    Hello,

    I have quite interesting problem.

    I have set up a macro to replace "phrase1" with "phrase2", "phrase3" with "phrase4" etc. The problem is, that I do it only in the selected part of the document (1st page of the document). My problem is that when the first replacement ends up the word asks me whether to continue in the rest of the document - I do not want to do it. How can I program macro to say no automatically?

    I have tried to do it several ways but I did not succeed yet (I am clicking the macro). I tried alt+n, tab and enter and many things, but my macro just does not want to do this automatically. Since I have many things to replace, it is not possible for the user just to be pressing no or so...

    The macro looks like this (MS word 2002):
    Sub Test001()
    '
    ' Test001 Macro
    ' Macro recorded 7/02/2008 by STRNAD
    '
    Selection.MoveDown Unit:=wdLine, Count:=4
    Selection.MoveUp Unit:=wdScreen, Count:=2, Extend:=wdExtend
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = "Phrase 1"
    .Replacement.Text = "Phrase 2"
    .Forward = True
    .Wrap = wdFindAsk
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    With Selection.Find
    .Text = "Phrase 3"
    .Replacement.Text = "Phrase 4"
    .Forward = True
    .Wrap = wdFindAsk
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll
    End Sub



    Thanks

    peter

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: problems with macros (MS Word 2002)

    Welcome to Woody's Lounge!

    The problem is the line
    <code>
    .Wrap = wdFindAsk
    </code>
    that occurs in each Find block. If you change it to
    <code>
    .Wrap = wdFindStop
    </code>
    Word shouldn't prompt the user whether to continue.

  3. #3
    New Lounger
    Join Date
    Feb 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: problems with macros (MS Word 2002)

    Hello,

    It WORKS!!!! Thanks a lot, you have helped me very much. :-)

    Thanks

    Peter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •