Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #18  
Old 06-25-2023, 11:01 PM
Guessed's Avatar
Guessed Guessed is offline check for duplicates of a word within next 100 words Windows 10 check for duplicates of a word within next 100 words Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,185
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

For me personally I can't see any value in tracking how close similar words fall so I'm not going to make time to work on this but I will add some code here that could be used to dramatically speed up the execution.

Hopefully someone will put their hand up and work on a way to make this more efficient and sort out your colouring issue. Macropod himself is less active here nowdays but he may feel like embracing a new challenge if he pops in to have a look around.

The following code collects all the words in the document and records how many times that word appears. You could use this to configure code that ONLY searches for words that occur more than once. This would be way faster.
Code:
Sub GetUniqueWordCounts()
  Dim aDict As New Scripting.Dictionary
  Dim wrd As Variant, sTemp As String, aKey As Variant
  
  With aDict
    For Each wrd In ActiveDocument.Range.Words
      sTemp = Trim(LCase(wrd))
      If Len(sTemp) > 0 Then
        Select Case Asc(sTemp)
          Case 97 To 122        'if the word starts with a lowercase letter it is something we are interested in
            If aDict.Exists(sTemp) Then
              aDict.Item(sTemp) = aDict.Item(sTemp) + 1
            Else
              aDict.Add sTemp, 1
            End If
        End Select
      End If
    Next wrd
  End With

  For Each aKey In aDict.Keys      'audit the values
    Debug.Print aKey, aDict(aKey)
  Next aKey
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
check for duplicates of a word within next 100 words Macro to check against Columns & Delete Duplicates cjamps Excel Programming 27 12-18-2017 06:38 AM
check for duplicates of a word within next 100 words how to check for duplicated words / cells ? iSlam Khaled Word Tables 11 05-05-2015 08:07 PM
check for duplicates of a word within next 100 words Adding words to spell check dictionary oakwoodbank Word 17 02-27-2015 08:09 PM
check for duplicates of a word within next 100 words Spell check adding words riweir Word 3 11-30-2011 09:03 PM
Edit spell check dic to exclude words? franklekens Word 1 07-03-2010 09:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:17 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft