Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-16-2012, 10:07 PM
Charles Kenyon Charles Kenyon is offline Error Code 5453 Word has finished searching the document Windows Vista Error Code 5453 Word has finished searching the document Office 2010 32bit
Moderator
Error Code 5453 Word has finished searching the document
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default Error Code 5453 Word has finished searching the document

I have a series of macros that replace given text in a document. Actually, they set up the Advanced Replace dialog so that the user can decide for each instance whether to replace or not.

The user clicks on the Find Next button and decides. After the search is complete and the cursor is back at the first page, pressing Close or Cancel in the Replace Dialog results in the error message:
Error Code 5453


Word has finished searching the document

The code for a macro follows:
Code:
Sub ReplaceAvenue()
'
' ReplaceAvenue Macro
'
'
    With Selection.Find
        .ClearFormatting
        .Replacement.ClearFormatting
        .Text = "Ave"
        .Replacement.Text = "Avenue"
        .Forward = True
        .Wrap = wdFindStop
        .Format = False
        .MatchCase = True
        .MatchWholeWord = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
    SendKeys "%m"
    Application.Dialogs(wdDialogEditReplace).Show
End Sub
As you can probably tell, it is based on a recorded macro. I can live with this but it is annoying.
Reply With Quote
  #2  
Old 05-17-2012, 02:03 AM
macropod's Avatar
macropod macropod is offline Error Code 5453 Word has finished searching the document Windows 7 64bit Error Code 5453 Word has finished searching the document Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

So why not prefix the code with 'On Error Resume Next'? Alternatively, you could trap that specific error. For example:
Code:
Sub ReplaceAvenue()
On Error GoTo Done
With Application.Dialogs(wdDialogEditReplace)
  SendKeys "%m"
  With Selection.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "Ave"
    .Replacement.Text = "Avenue"
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchCase = True
    .MatchWholeWord = True
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
  End With
  .Show
End With
Done:
If Err.Number = 5452 Then Exit Sub
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 05-17-2012, 11:18 AM
Charles Kenyon Charles Kenyon is offline Error Code 5453 Word has finished searching the document Windows Vista Error Code 5453 Word has finished searching the document Office 2010 32bit
Moderator
Error Code 5453 Word has finished searching the document
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Thank you for the reminder.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA in Excel: Add a new Word Document on Template (Type Mismatch Error)) tinfanide Excel Programming 1 03-29-2012 09:10 AM
Error Code 5453 Word has finished searching the document Finding or searching ^ character in word document shahin3121 Word 2 03-05-2012 06:16 PM
Error Code 5453 Word has finished searching the document Microsoft Code Error 1907 JHauglid Office 1 02-27-2012 12:15 AM
Error code 0x800CCC80 Kevin Outlook 1 03-18-2011 07:20 AM
Word: The document 'Filename' caused a serious error the last time ... martincruise Word 0 02-25-2010 01:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:43 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft