Macro interrupt
Results 1 to 3 of 3

Thread: Macro interrupt

  1. #1
    Join Date
    Jan 2000
    Posts
    3

    Macro interrupt

    I have written a macro in Word 97 where all text is selected, certain characters are looked for and replaced. (see below)

    The macro works find. However, at the end of the replace process, the macro stops and displays the window where it tells me that the selection had been searched and whether I want the process done for the rest of the document.

    It is annoying that the macro stops and asks for the input. Is there any way that I can suppress this message. Especially, since as part of the macro the whole document is selected.

    Thanks for your help. Any response is appreciated.

    Issam

    Selection.WholeStory
    Selection.Font.Size = 12
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = " "
    .Replacement.Text = " "
    .Forward = True
    .Wrap = wdFindAsk
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With

  2. #2
    Join Date
    Feb 2000
    Location
    Hamilton, Ontario, Canada
    Posts
    47
    Wow ... there doesn't seem to be a flag to stop it from doing that ... how annoying is that!

    Anyway, when all else fails, it's always useful to try a SendKeys event. I was able to make it work using that. In my example I ended up having to manually press Enter twice to get past the messages on the screen, so I had to do the following in front of the final command to execute the Replace, as below:

    SendKeys "{enter}{enter}" Selection.Find.Execute Replace:=wdReplaceAll

  3. #3
    Join Date
    Jan 2000
    Posts
    3
    Great Advice! That worked just fine. It all happens seemlessly. So thanks a lot.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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