Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Office 97 - stop Find/replace prompts!

Status
Not open for further replies.

ShaneBrennan

Programmer
May 19, 1999
198
GB
I've written a VBA macro in Word 97 to strip out strip out control characters from a HTML document - unfortunetly each time I as the computer to carry out a search and replace a msgbox keeps appearing - and I have to keep selecting YES!

Is there someway I can disable this, or use a command such as SendKeys so the macro just gets on with it?

Any help with this small but anoying problem would be welcomed.

Thanks in advance

Shane Shane Brennan

'-----------------------
' ICQ#125948839
' Emails: sab149@icqmail.com
' shanebrennan@postmaster.co.uk
' Personal ICQ Comms. Centre: wwp.icq.com/125948839
'
' Personal WebPage:
 
Change your code to follow this syntax:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "xxx"
.Replacement.Text = "yyy"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll


(If any of the items with False values are not being used, these lines can be deleted.) Brainbench MVP for Microsoft Word
techsupportgirl@home.com
 
Actually all you need to add to your Search and Replace macro is to set the Wrap property of the Find object to either wdFindStop or wdFindContinue. Default is wdFindAsk, hence the message box.
 
Thanks for the help, I'll give it a go in a while

Shane Shane Brennan

'-----------------------
' ICQ#125948839
' Emails: sab149@icqmail.com
' shanebrennan@postmaster.co.uk
' Personal ICQ Comms. Centre: wwp.icq.com/125948839
'
' Personal WebPage:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top