Search/replace VBS does not replace anything

SiGWare 0 Reputation points
2025-01-07T21:03:20.0333333+00:00

What is wrong with the VBS code below that it doesn't perform the replacement? It counts the founds. The test text is shown after the code.

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Text = "\^0060I\^0062(*@)\^0060\^0047I\^0062"
Selection.Find.Replacement.Text = "\1"
Selection.Find.Replacement.Style = ActiveDocument.Styles("charItalic")
Selection.Find.Replacement.ClearFormatting
Selection.Find.Forward = True
Selection.Find.Wrap = wdFindContinue
Selection.Find.Format = True
Selection.Find.MatchWildcards = True
Selection.Find.Execute

Do While Selection.Find.Found = True
    intDecodes = intDecodes + 1
    Selection.Find.Execute
Loop
```A megtaláló, aki 2024. augusztus 31-én egy mannheimi kertben bukkant a rovarra, egy applikáció segítségével először ázsiai lódarázsként <I>(Vespa velutina)</I> azonosította – tehát felismerte, hogy új faj a hártyásszárnyúak között, és nem az őshonos európai lódarázs <I>(Vespa crabro).</I> A megfigyelési adatokat és a darázs fényképét feltöltötte az oldalra, a NABU|naturgucker közössége pedig pontosította a találatot, méghozzá nem kis megdöbbenéssel: mindaddig ugyanis nem volt ilyen bizonyíték a faj előfordulására Németországban.        
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,202 questions
Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
949 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.