Results 1 to 4 of 4
  1. #1
    3 Star Lounger rcbjr2's Avatar
    Join Date
    Jan 2001
    Location
    Matthews, NC
    Posts
    279
    Thanks
    6
    Thanked 1 Time in 1 Post

    EditReplace Macro Error Messages (Word 2000/2002)

    I am trying to write a macro that will launch the EditReplace dialog in Word so that I can be sure that the previous settings in the dialog are erased each time I display the dialog. I recorded some code and add the Dialogs line below:

    Sub CtrlQA()
    '
    ' QuickReplace Macro
    ' Ctrl+Q, A -- Replace Dialog
    '
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = ""
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Dialogs(wdDialogEditReplace).Show
    End Sub

    However, the messages presented when the dialog is done are showing up as VBA errors instead of just the usual Word dialog on screen. It's like the .SHOW routine is keeping control of the dialog rather than ending the macro as soon as the dialog displays. Anybody know what code I'm missing to get this to work??

    Thanks!!

    -Rich

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

    Re: EditReplace Macro Error Messages (Word 2000/2002)

    If you want to suppress the error messages, insert a line

    On Error Resume Next

    above the line that shows the dialog.

  3. #3
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: EditReplace Macro Error Messages (Word 2000/2002)

    Or, since you probably want the message (just not displayed as an error):
    Show the dialog by calling the command "EditReplace" through its ID:
    CommandBars.FindControl(Id:=313).Execute

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>Klaus

  4. #4
    3 Star Lounger rcbjr2's Avatar
    Join Date
    Jan 2001
    Location
    Matthews, NC
    Posts
    279
    Thanks
    6
    Thanked 1 Time in 1 Post

    Re: EditReplace Macro Error Messages (Word 2000/2002)

    Yes, I do want to see the error, cause it's usually that it's already replaced everything, or can't find anything else, so I'll try this. Thx.

    -Rich

Posting Permissions

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