انتقل إلى المحتوى الرئيسي

كيفية البحث عن كلمات متعددة واستبدالها في نفس الوقت في مستند Word؟

يوفر Word وظيفة "بحث واستبدال" للعثور على كافة مثيلات كلمة أو عبارة واستبدالها بكلمة جديدة في نفس الوقت. ولكن إذا كنت تريد البحث عن كلمات مختلفة واستبدالها في نفس الوقت ، فلن تساعدك هذه الوظيفة المدمجة. في هذه المقالة ، نتحدث عن طريقة VBA للبحث عن عدة كلمات مختلفة واستبدالها في نفس الوقت في مستند Word.

ابحث عن كلمات متعددة واستبدلها في نفس الوقت في Word برمز VBA
يمكنك العثور بسهولة على كلمات متعددة واستبدالها في نفس الوقت في Word بميزة مذهلة


ابحث عن كلمات متعددة واستبدلها في نفس الوقت في Word برمز VBA

يرجى القيام بما يلي للبحث عن كلمات متعددة واستبدالها في نفس الوقت في مستند Word.

1. افتح مستند Word الذي تريد البحث عنه واستبدال عدة كلمات في نفس الوقت ، ثم اضغط على قديم + F11 مفاتيح لفتح ميكروسوفت فيسوال باسيك للتطبيقات نافذة.

2. في ال ميكروسوفت فيسوال باسيك للتطبيقات الإطار، انقر فوق إدراج > وحدة. ثم انسخ رمز VBA أدناه في نافذة الوحدة النمطية.

رمز VBA: ابحث عن كلمات متعددة واستبدلها في نفس الوقت في 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. اضغط على F5 مفتاح لتشغيل الكود.

4. في الأول كوتولس للكلمة في مربع الحوار ، أدخل الكلمات المتعددة التي ستجدها واستبدلها في مربع النص ، وافصل بينها بفاصلة ، ثم انقر فوق OK زر. انظر لقطة الشاشة:

5. في الثانية كوتولس للكلمة في مربع الحوار ، أدخل الكلمات الجديدة التي ستستبدلها (يجب أيضًا فصل هذه الكلمات بفاصلات) ، ثم انقر فوق OK .

ملحوظة: في هذه الحالة ، كل شيء "KTE" في هذا المستند سيتم استبداله بـ "جديد"، و "KTO" و "KTW" سيتم استبدال مع "اختبار" و "إنهاء". الرجاء تغييرها لاحتياجاتك.


يمكنك العثور بسهولة على كلمات متعددة واستبدالها في نفس الوقت في Word بميزة مذهلة

بحث واستبدال دفعة سمة من سمات كوتولس للكلمة يمكن أن يساعد في العثور بسهولة على نصوص مختلفة واستبدالها في مستند أو عبر مستندات متعددة في نفس الوقت.

قبل تطبيق هذه الميزة ، يرجى أخذ دقائق إلى قم بتنزيله وتثبيته أولاً.

1. قم بتشغيل تطبيق Microsoft Word ، انقر فوق كوتولس بلس > بحث واستبدال دفعة.

2. في ال بحث واستبدال دفعة نافذة ، يرجى تكوين على النحو التالي.

  • 2.1 انقر فوق ملف زر> إضافة ملف or إضافة مجلد لإضافة مستند واحد أو أكثر ستجد فيه عدة كلمات واستبدالها.
  • شنومك انقر فوق اضف سطر زر لإدراج حقول البحث والاستبدال. إذا كنت تريد البحث عن ثلاثة نصوص مختلفة واستبدالها في نفس الوقت ، فيرجى إنشاء ثلاثة صفوف.
  • 2.3 في كل صف ، أدخل الكلمات الموجودة التي ستستبدلها بأخرى جديدة في العمود ، ثم أدخل الكلمات الجديدة في ملف استبدل العمود.
  • 2.4 تحديد نوع البحث لكل صف.
  • 2.5 في تجد في العمود ، اختر مكان تطبيق البحث والاستبدال. ويشمل الوثيقة الرئيسية, رأس و تذييل في هذا القسم. يمكنك اختيار واحد منهم أو اثنين أو كل منهم حسب احتياجاتك.
  • 2.6. انقر فوق استبدل زر لبدء العملية. انظر لقطة الشاشة:

ثم يتم استبدال الكلمات المحددة في المستندات المحددة في نفس الوقت.

تلميح: يمكنك تمييز النتيجة بلون الخلفية عن طريق تحديد لون معين في تنسيق تسليط الضوء عمود لصف.

  إذا كنت ترغب في الحصول على نسخة تجريبية مجانية (60 يومًا) من هذه الأداة المساعدة ، الرجاء الضغط لتنزيلهثم انتقل لتطبيق العملية حسب الخطوات المذكورة أعلاه.

أفضل أدوات إنتاجية المكتب

كوتولس للكلمة - ارفع تجربة كلمتك مع أكثر 100 ميزات رائعة!

🤖 مساعد كوتولس AI: تحويل كتابتك باستخدام الذكاء الاصطناعي - توليد المحتوى  /  إعادة كتابة النص  /  تلخيص المستندات  /  الاستفسار عن المعلومات على أساس الوثيقة، كل ذلك داخل Word

📘 إتقان الوثيقة: تقسيم الصفحات  /  دمج المستندات  /  تصدير التحديد بتنسيقات مختلفة (PDF/TXT/DOC/HTML...)  /  دفعة تحويل إلى PDF  /  تصدير الصفحات كصور  /  طباعة ملفات متعددة في وقت واحد

تحرير المحتويات: بحث واستبدال دفعة عبر ملفات متعددة  /  تغيير حجم كافة الصور  /  تبديل صفوف وأعمدة الجدول  /  تحويل الجدول إلى نص

🧹 تنظيف سهل: اكتساح بعيدا مساحات اضافية  /  فواصل القسم  /  كل الرؤوس  /  مربعات النص  /  الارتباطات التشعبية  / لمزيد من أدوات الإزالة، توجه إلى موقعنا إزالة المجموعة

إدراجات إبداعية: إدراج الف فاصل  /  مربعات الاختيار  /  أزرار الراديو  /  رمز الاستجابة السريعة  /  الباركود  /  جدول الخط القطري  /  شرح المعادلة  /  صورة توضيحية  /  الجدول التوضيحي  /  صور متعددة  / اكتشف المزيد في أدخل المجموعة

🔍 التحديدات الدقيقة: يحدد بدقة صفحات محددة  /  الجداول  /  الأشكال  /  فقرات العناوين  / تحسين التنقل باستخدام الأكثر من ذلك حدد الميزات

تحسينات النجوم: انتقل بسرعة إلى أي مكان  /  الإدراج التلقائي للنص المتكرر  /  التبديل بسلاسة بين نوافذ المستندات  /  11 أدوات التحويل

؟؟؟؟ هل تريد تجربة هذه الميزات؟ يقدم Kutools for Word أ الإصدار التجريبي المجاني من 60 يومًا، بلا حدود! 🚀
 
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