Ugrás a tartalomra

Hogyan lehet egyszerre több szót megtalálni és lecserélni egy Word dokumentumban?

A Word egy Keresés és csere funkciót kínál a szó vagy kifejezés összes példányának megkereséséhez és egyidejűleg új szóval történő helyettesítéséhez. De ha egyszerre szeretne különböző szavakat keresni és kicserélni, akkor ez a beépített funkció nem segíthet. Ebben a cikkben egy VBA módszerről beszélünk, amely egyszerre több különböző szót keres és cserél a Word dokumentumban.

Keressen és cseréljen le egyszerre több szót a Wordben VBA kóddal
Könnyen megtalálhatja és lecserélheti egyszerre több szót egy Word-ben egy csodálatos funkcióval


Keressen és cseréljen le egyszerre több szót a Wordben VBA kóddal

Kérjük, tegye a következőket, ha egyszerre több szót szeretne keresni és kicserélni egy Word dokumentumban.

1. Nyissa meg a keresni kívánt Word-dokumentumot, és cserélje ki egyszerre több szót, majd nyomja meg a gombot más + F11 billentyűk megnyitásához Microsoft Visual Basic for Applications ablak.

2. Ban,-ben Microsoft Visual Basic for Applications ablakban kattintson betétlap > Modult. Ezután másolja a VBA kód alatt a Modul ablakba.

VBA kód: Több szó keresése és cseréje egyszerre a Wordben

Sub FindAndReplaceMultiItems()
'Update by ExtendOffice 2018/10/25
    Dim xFind As String
    Dim xReplace As String
    Dim xFindArr, xReplaceArr
    Dim I As Long
    Application.ScreenUpdating = False
    xFind = InputBox("Enter items to be found here,seperated by comma: ", "Kutools for Word")
    xReplace = InputBox("Enter new items here, seperated by comma: ", "Kutools for Word")
    xFindArr = Split(xFind, ",")
    xReplaceArr = Split(xReplace, ",")
    If UBound(xFindArr) <> UBound(xReplaceArr) Then
        MsgBox "Find and replace characters must be equal.", vbInformation, "Kutools for Word"
        Exit Sub
    End If
    For I = 0 To UBound(xFindArr)
        Selection.HomeKey Unit:=wdStory
        With Selection.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Text = xFindArr(I)
            .Replacement.Text = xReplaceArr(I)
            .Format = False
            .MatchWholeWord = False
        End With
        Selection.Find.Execute Replace:=wdReplaceAll
    Next
    Application.ScreenUpdating = True
End Sub

3. megnyomni a F5 gombot a kód futtatásához.

4. Az elsőben Kutools for Word párbeszédpanelen írja be a megtalált és kicserélt több szót a szövegmezőbe, és vesszővel válassza el őket, majd kattintson a gombra OK gomb. Lásd a képernyőképet:

5. A másodikban Kutools for Word párbeszédpanelen írja be az új szavakat, amelyekre cserélni kívánja (ezeket a szavakat vesszővel is el kell választani), majd kattintson a gombra OK gombot.

Jegyzet: Ebben az esetben mind „KTE” ebben a dokumentumban a következőre kerül: "Új", és a „KTO” és a „KTW” helyettesíteni fogják "Teszt" és a "Befejez". Kérjük, módosítsa őket az Ön igényeinek megfelelően.


Könnyen megtalálhatja és lecserélheti egyszerre több szót egy Word-ben egy csodálatos funkcióval

A Kötegelt keresés és csere jellemzője Kutools for Word segíthet a különböző szövegek egyszerű megtalálásában és cseréjében egy dokumentumban vagy több dokumentumban egyszerre.

Mielőtt alkalmazná ezt a funkciót, kérjük, szánjon néhány percet erre először töltse le és telepítse.

1. Indítsa el a Microsoft Word alkalmazást, kattintson a gombra Kutools Plus > Kötegelt keresés és csere.

2. Ban,-ben Kötegelt keresés és csere ablakot, kérjük, konfigurálja a következőképpen.

  • 2.1 kattintson a gombra gomb> Fájl hozzáadása or Mappa hozzáadása egy vagy több dokumentum hozzáadásához, amelyben több szót is megtalál és kicserél.
  • 2.2 Kattintson a gombra Sor hozzáadása gombra a mezők megkereséséhez és cseréjéhez. Ha egyszerre három különböző szöveget szeretne megtalálni és kicserélni, kérjük, hozzon létre három sort.
  • 2.3 Minden sorba írja be a meglévő szavakat, amelyeket kicserél egy újakra a Találjon oszlopban, majd írja be az új szavakat a Cserélje oszlop.
  • 2.4 Adja meg a Keresés típusa minden sorhoz.
  • 2.5 A Keresse meg oszlopban válassza ki a keresés és a csere helyét. Magába foglalja Fő dokumentum, Fejléc és a Lábléc ebben a részben. Választhat közülük egyet, kettőt vagy mindegyiket az igényeinek megfelelően.
  • 2.6. Kattintson a Cserélje gombot a művelet megkezdéséhez. Lásd a képernyőképet:

Ezután a konkrét szavakat egyszerre cserélik ki a kiválasztott dokumentumokba.

Tipp: Kiemelheti az eredményt háttérszínnel, ha megad egy bizonyos színt a Kiemel oszlopot egy sorhoz.

  Ha ingyenes (60 napos) próbaverziót szeretne kapni a segédprogramról, kattintson a letöltéshez, majd lépjen a művelet végrehajtására a fenti lépések szerint.

A legjobb irodai hatékonyságnövelő eszközök

Kutools for Word - Növelje Word-élményét az Over segítségével 100 Figyelemre méltó tulajdonságok!

🤖 Kutools AI asszisztens: Alakítsa át írását mesterséges intelligencia segítségével - Tartalom létrehozása  /  Szöveg átírása  /  Összefoglalja a dokumentumokat  /  Információért érdeklődjön dokumentum alapján, mindezt a Word-en belül

📘 Dokumentummesterség: Felosztott oldalak  /  Dokumentumok egyesítése  /  Kijelölés exportálása különböző formátumokban (PDF/TXT/DOC/HTML...)  /  Kötegelt konvertálás PDF-be  /  Oldalak exportálása képként  /  Nyomtasson több fájlt egyszerre...

Tartalom Szerkesztés: Kötegelt keresés és csere Több fájl között  /  Minden kép átméretezése  /  Transzponálja a táblázat sorait és oszlopait  /  Táblázat konvertálása szöveggé...

🧹 Könnyed tisztítás: Söpörj el Extra helyek  /  Szakaszszünetek  /  Minden fejléc  /  Szövegdobozok  /  Hiperhivatkozások  / További eltávolító eszközökért látogasson el a mi oldalunkra Csoport eltávolítása...

Kreatív betétek: Beszúrás Ezer elválasztó  /  Jelölőnégyzetek  /  Rádió gombok  /  QR-kód  /  Vonalkód  /  Átlós vonal táblázat  /  Egyenletfelirat  /  Képfelirat  /  Táblázat felirata  /  Több kép  / Fedezzen fel többet a Csoport beszúrása...

???? Precíziós kiválasztás: Pontosan konkrét oldalak  /  asztalok  /  formák  /  címsor bekezdései  / A navigáció javítása a következővel: több Jelölje ki a funkciókat...

Star Enhancements: Gyorsan navigáljon bármely helyre  /  ismétlődő szöveg automatikus beszúrása  /  zökkenőmentesen válthat a dokumentumablakok között  /  11 Konverziós eszközök...

???? Ki szeretné próbálni ezeket a funkciókat? A Kutools for Word kínál a 60 napos ingyenes próba, korlátozások nélkül! 🚀
 
Comments (23)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
The VBA script you provide here seems to work only for Latin characters; is there some workaround to get special characters to work.
I work with Sanskrit, which used the Devanagari script, similar to Hindi. (1) The VBA does not accept the Devanagai font nor does it find the Latin characters with diacriticals. For example: It fails miserably if I search for mūlādhāra (मूलाधार). It doesn't seem to recognize the ū or ā, for example, and the Devanagari is a complete loss.

Moreover, does the script recognize spaces between words? If not, how do I get them in there?

Thank you!
This comment was minimized by the moderator on the site
Chào bạn, có cách nào thay thế RẤT NHIỀU cụm từ bằng RẤT NHIỀU cụm từ khác (nhập từng cụm từ rất mất thời gian) bằng cách m lập một file trong đó có 2 cột, 1 cột là cụm từ nguồn và cột 2 là cụm từ đích được không? rất cám ơn bạn.
This comment was minimized by the moderator on the site
Hi Nguyễn Phúc Lâm,
I recommand you apply the Batch Find and Replace feature of Kutools for Word (the second method in this post) to solve this problem.
In the Find and Replace dialog box, after creating the two columns you need, you can save the current settings as a scenaria for future use.
https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/find_and_replace.png
This comment was minimized by the moderator on the site
Cám ơn Crystal, cách này có thể áp dụng với một số lượng nhỏ các cụm từ, nếu với số lượng các cụm từ lớn (hơn 1000, hơn 10000.. cụm từ) thì rất khó để có thể nhập thủ công. Vậy có cách nào khác không bạn? Cám ơn bạn đã trả lời
This comment was minimized by the moderator on the site
Hi Nguyễn Phúc Lâm,
Temporarily unable to deal with this problem with VBA code as it is a bit complex. This feature will be considered for upgrade in the next release. Sorry for the inconvenience.
This comment was minimized by the moderator on the site
Thanks for the project, Could you make it the way we can also replace letters in words. For example if i want to change Dollar as DoLLar it does not function.
This comment was minimized by the moderator on the site
In the first instruction (Find And Replace Multiple Words At The Same Time In Word With VBA Code), it does not find instances where the word to be replaced falls in the middle of a word (For example, .com following a website name). Can this be modified to do so?
This comment was minimized by the moderator on the site
What if I'm trying to replace commas?
This comment was minimized by the moderator on the site
The VBA code can't help to replace commas. You can apply Kutools to achieve.
This comment was minimized by the moderator on the site
After hitting Replace it just goes to Preview and doesn't do anything further.
This comment was minimized by the moderator on the site
Hi Ajs,All required words have been successfully replaced at once after hitting the Replace button. It goes to the Preview tab to help you know how many words have been successfully replaced. After that, close the dialog box.
This comment was minimized by the moderator on the site
Hi! First, congratulations for your work: this macro is very useful and interesting! I would like, neverthless, you help me with one thing. I am a proofreader and would like the replacements would highlithed in green or red color. How can I do this? Is there a code line I could use?
This comment was minimized by the moderator on the site
Hi, The Batch Find and Replace feature of Kutools for Word can perfectly solve your problem, you can have a try.
This comment was minimized by the moderator on the site
Hi how can this macro be revised to take more key words? I have about 170 words that I wold like to find and replace
This comment was minimized by the moderator on the site
Hi JM,
After running the code, a Kutools for Excel dialog box will pop up, please enter the keywords you will find and separate them with commas.
This comment was minimized by the moderator on the site
How to find and select multiple words at the same time
This comment was minimized by the moderator on the site
Hi,
After running the code, a Kutools for Excel dialog box will pop up, please enter the keywords you will find and separate them with commas.
This comment was minimized by the moderator on the site
Hi, This works well with English Words. Now I am doing a document where I translate English to Gujarati. So, when I apply this, (Find English Words) and (Replace with Gujarati words), it does change but it appears like "???". Doesn't show the Gujarati word but just question marks? Any further help? Please.
This comment was minimized by the moderator on the site
I'm have a similar problem with Sanskrit, not only the Devanagari script but also the English/Latin diacriticals on the special characters like ā, ū, ṛ, ṁ, ṃ, etc. Any suggestions for a workable fix?
This comment was minimized by the moderator on the site
Hello Shailesh, facing the same issue. Did you find a solution to it. Am also trying to figure out how to change from Chinese to English.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations