اذهب الي المحتوي
أوفيسنا

البحث عن فقرة مكررة داخل الورد


الردود الموصى بها

السلام عليكم اخوتي 

معي ملف ورد به اكثر من 300 صفحة 

اريد ان اعمل بحث هل يوجد جملة تم تكرارها او كلمة مكررة مرتين او ما شابه ذلك 

بحيث صعب اقرأ كامل النص للبحث عن المطلوب 

 

وشكرًا لكم جميعًا

رابط هذا التعليق
شارك

وعليكم السلام ورحمة الله وبركاته

للبحث عن الفقرات المكررة تفضل هذا الكود:

Sub highlightdup()
    Dim I, J As Long
    Dim xRngFind, xRng As Range
    Dim xStrFind, xStr As String
    Options.DefaultHighlightColorIndex = wdYellow
    With ActiveDocument
        For I = 1 To .Paragraphs.Count - 1
            Set xRngFind = .Paragraphs(I).Range
            If xRngFind.HighlightColorIndex <> wdYellow Then
                For J = I + 1 To .Paragraphs.Count
                    Set xRng = .Paragraphs(J).Range
                    If xRngFind.Text = xRng.Text Then
                        xRngFind.HighlightColorIndex = wdBrightGreen
                        xRng.HighlightColorIndex = wdYellow
                    End If
                Next
            End If
        Next
    End With
End Sub

 

للبحث عن الجمل المكررة تفضل هذا الكود:

Sub Test()
    Dim i, j, nrOfSentences As Integer
    Dim s As String
    nrOfSentences = ActiveDocument.Sentences.Count
    For i = 1 To nrOfSentences - 1
        s = ActiveDocument.Sentences(i)
          For j = i + 1 To nrOfSentences
            If s = ActiveDocument.Sentences(j) Then
                ActiveDocument.Sentences(j).HighlightColorIndex = wdYellow
                ActiveDocument.Sentences(i).HighlightColorIndex = wdYellow
            End If
        Next
    Next i
End Sub

 

العملية قد تأخذ وقتاً بحسب عدد صفحات الملف، فقد يستمر الأمر لدقائق، وخاصة فيما يتعلق بالجمل، فـ 300 صفحة ممكن تأخذ ساعة لتتم العملية بنجاح.

تم تعديل بواسطه شحادة بشير
رابط هذا التعليق
شارك

  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information