*!* With Options *!* .CheckSpellingAsYouType = False *!* .CheckGrammarAsYouType = True *!* .SuggestSpellingCorrections = True *!* .SuggestFromMainDictionaryOnly = False *!* .CheckGrammarWithSpelling = True *!* .ShowReadabilityStatistics = False *!* .IgnoreUppercase = True *!* .IgnoreMixedDigits = True *!* .IgnoreInternetAndFileAddresses = True *!* .AllowCombinedAuxiliaryForms = True *!* .EnableMisusedWordsDictionary = True *!* .AllowCompoundNounProcessing = True *!* .UseGermanSpellingReform = True *!* End With function SearchAndReplace_Word lparameters WordObj, SearchFor, ReplaceWith, MatchCase, MatchWholeWord, ; MatchWildCards, MatchSoundsLike, MatchAllWordForms, FormatInfoAlso #define wdFindStop 0 #define wdFindContinue 1 #define wdFindAsk 2 #define wdReplaceNone 0 #define wdReplaceOne 1 #define wdReplaceAll 2 for each StoryRange in WordObj.ActiveDocument.StoryRanges with StoryRange .WholeStory .Find.ClearFormatting .Find.Replacement.ClearFormatting local Forward, Wrap Forward = TRUE Wrap = wdFindContinue && replacement max 254 chars do case case len(ReplaceWith) <= 254 =StoryRange.Find.Execute(SearchFor, MatchCase, MatchWholeWord, MatchWildCards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, FormatInfoAlso, ReplaceWith, wdReplaceAll, , , , ) otherwise local x, xReplace, ReplaceLeft ReplaceLeft = ReplaceWith do while !empty(len(ReplaceLeft) ) do case case len(ReplaceLeft) < 255 xReplace = ReplaceLeft ReplaceLeft = '' otherwise xReplace = left(ReplaceLeft, 254 - len(SearchFor)) + SearchFor ReplaceLeft = Substr(ReplaceLeft, 254 - len(SearchFor) + 1) endcase =StoryRange.Find.Execute(SearchFor, MatchCase, MatchWholeWord, MatchWildCards, MatchSoundsLike, MatchAllWordForms, Forward, Wrap, FormatInfoAlso, xReplace, wdReplaceAll, , , , ) enddo endcase endwith endfor #undefine wdFindStop #undefine wdFindContinue #undefine wdFindAsk #undefine wdReplaceNone #undefine wdReplaceOne #undefine wdReplaceAll endfunc *--------------------------------------------------------------------------