Skip i'r prif gynnwys

Sut i ddod o hyd i eiriau lluosog a'u disodli ar yr un pryd mewn dogfen Word?

Mae Word yn darparu swyddogaeth Darganfod ac Amnewid i ddod o hyd i bob enghraifft o air neu ymadrodd a rhoi gair newydd yn eu lle ar yr un pryd. Ond os ydych chi am ddod o hyd i wahanol eiriau a'u disodli ar yr un pryd, ni all y swyddogaeth adeiladu hon helpu. Yn yr erthygl hon, rydym yn siarad am ddull VBA i ddarganfod a disodli sawl gair gwahanol ar yr un pryd yn nogfen Word.

Darganfyddwch a disodli geiriau lluosog ar yr un pryd yn Word gyda chod VBA
Hawdd dod o hyd i eiriau lluosog a'u disodli ar yr un pryd yn Word gyda nodwedd anhygoel


Darganfyddwch a disodli geiriau lluosog ar yr un pryd yn Word gyda chod VBA

Gwnewch fel a ganlyn i ddod o hyd i air lluosog a'i ddisodli ar yr un pryd mewn dogfen Word.

1. Agorwch y ddogfen Word rydych chi am ddod o hyd iddi a newid geiriau lluosog ar yr un pryd, yna pwyswch y Alt + F11 allweddi i agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Yn y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, cliciwch Mewnosod > Modiwl. Yna copïwch isod god VBA i mewn i ffenestr y Modiwl.

Cod VBA: Darganfyddwch a disodli geiriau lluosog ar yr un pryd yn Word

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. Gwasgwch y F5 allwedd i redeg y cod.

4. Yn y cyntaf Kutools am Word blwch deialog, nodwch y geiriau lluosog y byddwch yn dod o hyd iddynt a'u disodli yn y blwch testun, a'u gwahanu â choma, yna cliciwch ar y OK botwm. Gweler y screenshot:

5. Yn yr ail Kutools am Word blwch deialog, nodwch y geiriau newydd y byddwch chi'n eu disodli (mae angen gwahanu'r geiriau hyn â choma hefyd), ac yna cliciwch ar y OK botwm.

Nodyn: Yn yr achos hwn, i gyd “KTE” yn y ddogfen hon bydd "Newydd", ac “KTO” ac “KTW” yn cael ei ddisodli gan “Prawf” ac "Gorffen". Os gwelwch yn dda eu newid i'ch anghenion.


Hawdd dod o hyd i eiriau lluosog a'u disodli ar yr un pryd yn Word gyda nodwedd anhygoel

Mae adroddiadau Swp Dod o Hyd i ac Amnewid nodwedd o Kutools am Word gall helpu i ddod o hyd i wahanol destunau a'u disodli mewn dogfen neu ar draws sawl dogfen ar yr un pryd.

Cyn defnyddio'r nodwedd hon, cymerwch funudau i ei lawrlwytho a'i osod yn gyntaf.

1. Lansio cymhwysiad Microsoft Word, cliciwch Kutools Byd Gwaith > Swp Dod o Hyd i ac Amnewid.

2. Yn y Swp Dod o Hyd i ac Amnewid ffenestr, ffurfweddwch fel a ganlyn.

  • 2.1 cliciwch y botwm> Ychwanegu Ffeil or Ychwanegu Ffolder i ychwanegu un neu fwy o ddogfennau lle byddwch chi'n dod o hyd i eiriau lluosog ac yn eu lle.
  • 2.2 Cliciwch y Ychwanegu rhes botwm i fewnosod y meysydd darganfod a disodli. Os ydych chi am ddod o hyd i dri thestun gwahanol a'u disodli ar yr un pryd, crëwch dair rhes.
  • 2.3 Ymhob rhes, nodwch y geiriau presennol y byddwch yn eu disodli gydag un newydd yn y Dod o hyd i colofn, ac yna rhowch y geiriau newydd i mewn i'r Disodli colofn.
  • 2.4 Nodwch y Math Chwilio ar gyfer pob rhes.
  • 2.5 Yn y Dewch o hyd i mewn colofn, dewiswch ble i gymhwyso'r darganfyddiad a'i ddisodli. Mae'n cynnwys Prif ddogfen, Pennawd ac Troedyn yn yr adran hon. Gallwch ddewis un ohonynt, dau ohonynt neu bob un ohonynt yn seiliedig ar eich anghenion.
  • 2.6. Cliciwch ar y Disodli botwm i ddechrau'r llawdriniaeth. Gweler y screenshot:

Yna mae'r geiriau penodol yn cael eu disodli mewn dogfennau dethol ar yr un pryd.

Tip: Gallwch dynnu sylw at y canlyniad gyda lliw cefndir trwy nodi lliw penodol yn y Amlygu colofn am res.

  Os ydych chi am gael treial am ddim (60 diwrnod) o'r cyfleustodau hwn, cliciwch i'w lawrlwytho, ac yna ewch i gymhwyso'r llawdriniaeth yn ôl y camau uchod.

Offer Cynhyrchiant Swyddfa Gorau

Kutools am Word - Dyrchafu Eich Profiad Word gyda Dros 100 Nodweddion Rhyfeddol!

🤖 Cynorthwy-ydd Kutools AI: Trawsnewidiwch eich ysgrifennu gydag AI - Cynhyrchu Cynnwys  /  Ailysgrifennu Testun  /  Crynhoi Dogfennau  /  Ymholwch am Wybodaeth yn seiliedig ar Ddogfen, i gyd o fewn Word

📘 Meistrolaeth Dogfen: Tudalennau Hollti  /  Uno Dogfennau  /  Dewis Allforio mewn Fformatau Amrywiol (PDF/TXT/DOC/HTML...)  /  Trosi swp i PDF  /  Allforio Tudalennau fel Delweddau  /  Argraffu Ffeiliau Lluosog ar unwaith...

Golygu Cynnwys: Swp Dod o Hyd i ac Amnewid ar draws Ffeiliau Lluosog  /  Newid Maint Pob Llun  /  Trawsosod Rhesi Bwrdd a Cholofnau  /  Trosi Tabl i Testun...

🧹 Ymdrech Glân: swap i ffwrdd Mannau Ychwanegol  /  Toriadau Adran  /  Pob Pennawd  /  Blychau Testun  /  hypergysylltiadau  / Am fwy o offer tynnu, ewch i'n Dileu Grŵp...

Mewnosodiadau Creadigol: mewnosod Mil o Wahanwyr  /  Blychau Gwirio  /  Botymau Radio  /  Cod QR  /  Cod Bar  /  Tabl Llinell Lletraws  /  Pennawd Hafaliad  /  Capsiwn Delwedd  /  Pennawd Tabl  /  Lluniau Lluosog  / Darganfod mwy yn y Mewnosod Grŵp...

🔍 Detholiadau Manwl: pinbwynt tudalennau penodol  /  tablau  /  siapiau  /  paragraffau pennawd  / Gwella llywio gyda mwy Dewiswch nodweddion...

Gwelliannau Seren: Llywiwch yn gyflym i unrhyw leoliad  /  auto-mewnosod testun ailadroddus  /  toglo'n ddi-dor rhwng ffenestri dogfennau  /  11 Offer Trosi...

???? Eisiau rhoi cynnig ar y nodweddion hyn? Mae Kutools ar gyfer Word yn cynnig a Treial am ddim 60-dydd, heb unrhyw gyfyngiadau! 🚀
 
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