Loncat ke daftar isi utama

Bagaimana menemukan dan mengganti beberapa kata secara bersamaan dalam dokumen Word?

Word menyediakan fungsi Temukan dan Ganti untuk menemukan semua contoh kata atau frasa dan menggantinya dengan kata baru pada saat yang bersamaan. Tetapi jika Anda ingin mencari dan mengganti kata yang berbeda pada saat yang sama, fungsi bawaan ini tidak dapat membantu. Pada artikel ini, kita berbicara tentang metode VBA untuk menemukan dan mengganti beberapa kata berbeda secara bersamaan di dokumen Word.

Temukan dan ganti beberapa kata secara bersamaan di Word dengan kode VBA
Temukan dan ganti beberapa kata sekaligus di Word dengan mudah dengan fitur luar biasa


Temukan dan ganti beberapa kata secara bersamaan di Word dengan kode VBA

Harap lakukan hal berikut untuk menemukan dan mengganti beberapa kata pada saat yang sama dalam dokumen Word.

1. Buka dokumen Word yang ingin Anda temukan dan ganti beberapa kata secara bersamaan, kemudian tekan lain + F11 kunci untuk membuka Microsoft Visual Basic untuk Aplikasi jendela.

2. Dalam Microsoft Visual Basic untuk Aplikasi window, klik Menyisipkan > Modul. Kemudian salin kode VBA di bawah ini ke jendela Modul.

Kode VBA: Temukan dan ganti beberapa kata secara bersamaan di 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. tekan F5 kunci untuk menjalankan kode.

4. Yang pertama Kutools for Word kotak dialog, masukkan beberapa kata yang akan Anda temukan dan ganti ke dalam kotak teks, dan pisahkan dengan koma, lalu klik OK tombol. Lihat tangkapan layar:

5. Di kedua Kutools for Word kotak dialog, masukkan kata-kata baru yang akan Anda ganti (kata-kata ini juga perlu dipisahkan dengan koma), lalu klik OK .

Catatan: Dalam hal ini, semuanya “KTE” dalam dokumen ini akan diganti dengan "Baru", dan “KTO” dan “KTW” akan diganti dengan "Uji" dan "Selesai". Harap ubah sesuai kebutuhan Anda.


Temukan dan ganti beberapa kata sekaligus di Word dengan mudah dengan fitur luar biasa

Grafik Temukan dan Ganti Batch fitur dari Kutools for Word dapat membantu dengan mudah menemukan dan mengganti teks yang berbeda dalam satu dokumen atau di beberapa dokumen sekaligus.

Sebelum menerapkan fitur ini, harap luangkan waktu untuk unduh dan instal terlebih dahulu.

1. Jalankan aplikasi Microsoft Word, klik Kutools Ditambah > Temukan dan Ganti Batch.

2. Dalam Temukan dan Ganti Batch jendela, harap konfigurasikan sebagai berikut.

  • 2.1 klik tombol> Tambah File or Tambah Folder untuk menambahkan satu atau lebih dokumen di mana Anda akan menemukan dan mengganti beberapa kata.
  • 2.2 Klik tombol Menambahkan baris tombol untuk menyisipkan bidang cari dan ganti. Jika Anda ingin mencari dan mengganti tiga teks berbeda secara bersamaan, buat tiga baris.
  • 2.3 Di setiap baris, masukkan kata yang ada yang akan Anda ganti dengan yang baru di Menemukan kolom, lalu masukkan kata baru ke dalam menggantikan kolom.
  • 2.4 Tentukan Pencarian Tipe untuk setiap baris.
  • 2.5 Dalam Temukan di kolom, pilih tempat untuk menerapkan temukan dan ganti. Itu termasuk Dokumen utama, Header dan Footer di bagian ini. Anda dapat memilih salah satunya, dua di antaranya atau semuanya berdasarkan kebutuhan Anda.
  • 2.6. Klik menggantikan tombol untuk memulai operasi. Lihat tangkapan layar:

Kemudian kata-kata tertentu diganti dalam dokumen yang dipilih pada saat bersamaan.

olymp trade indonesiaTip: Anda dapat menyorot hasil dengan warna latar belakang dengan menentukan warna tertentu di Menyoroti kolom untuk satu baris.

  Jika Anda ingin memiliki uji coba gratis (60 hari) dari utilitas ini, silahkan klik untuk mendownloadnya, lalu lanjutkan untuk menerapkan operasi sesuai langkah di atas.

Alat Produktivitas Kantor Terbaik

Kutools for Word - Tingkatkan Pengalaman Kata Anda dengan Over 100 Fitur Luar Biasa!

🤖 Asisten AI Kutools: Ubah tulisan Anda dengan AI - Hasilkan Konten  /  Menulis Ulang Teks  /  Meringkas Dokumen  /  Menanyakan Informasi berdasarkan Dokumen, semuanya dalam Word

📘 Penguasaan Dokumen: Halaman Terpisah  /  Gabungkan Dokumen  /  Ekspor Pilihan dalam Berbagai Format (PDF/TXT/DOC/HTML...)  /  Konversi Batch ke PDF  /  Ekspor Halaman sebagai Gambar  /  Cetak Banyak File sekaligus...

Pengeditan Isi: Temukan dan Ganti Batch di Banyak File  /  Ubah Ukuran Semua Gambar  /  Ubah Urutan Baris dan Kolom Tabel  /  Ubah Tabel menjadi Teks...

🧹 Bersih dengan Mudah: Menyapu Spasi Ekstra  /  Bagian Istirahat  /  Semua Header  /  Teks box  /  Hyperlink  / Untuk alat penghapus lainnya, kunjungi kami Hapus Grup...

Sisipan Kreatif: Memasukkan Seribu Pemisah  /  Kotak Centang  /  Tombol Radio  /  Kode QR  /  barcode  /  Tabel Garis Diagonal  /  Keterangan Persamaan  /  Keterangan gambar  /  Keterangan Tabel  /  Banyak Gambar  / Temukan lebih lanjut di Sisipkan Grup...

🔍 Pilihan Presisi: Tepat halaman tertentu  /  tabel  /  bentuk  /  paragraf judul  / Tingkatkan navigasi dengan lebih Pilih fitur...

Peningkatan Bintang: Navigasi dengan cepat ke lokasi mana pun  /  menyisipkan teks berulang secara otomatis  /  beralih antar jendela dokumen dengan mulus  /  11 Alat Konversi...

👉 Ingin mencoba fitur-fitur tersebut? Kutools for Word menawarkan a Uji coba gratis 60-hari, tanpa batasan! 🚀
 
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