Forum

Notifications
Clear all

export Spell Checked words to a list

4 Posts
2 Users
0 Reactions
206 Views
(@chrisfcorriganoil-com)
Posts: 4
Active Member
Topic starter
 

Is there a way to export the words that Excel's Spell Check finds as misspellings to an editable list?  Ultimately, I am trying to manually categorize what Excel finds as a misspelled word into acronyms, surnames, truly misspelled words, etc.

 
Posted : 30/09/2023 2:39 pm
(@cmckeever)
Posts: 38
Trusted Member
 

Solution from ChatGPT:

 

Sub ExtractMisspelledWords()

    Dim rng As Range

    Dim cell As Range

    Dim misspelledWords As Object

    Dim word As Variant

    Dim outputRow As Long

 

    ' Define the range you want to check for misspellings

    Set rng = ThisWorkbook.Sheets("Sheet1").Range("A1:A100")

   

    ' Create a dictionary to store misspelled words

    Set misspelledWords = CreateObject("Scripting.Dictionary")

 

    ' Loop through each cell in the defined range

    For Each cell In rng

        If Not IsEmpty(cell) Then

            For Each word In Split(cell.Value, " ")

                If Not Application.CheckSpelling(word) Then

                    If Not misspelledWords.exists(word) Then

                        misspelledWords.Add word, Nothing

                    End If

                End If

            Next word

        End If

    Next cell

 

    ' Output misspelled words to another worksheet

    Set rng = ThisWorkbook.Sheets("Sheet2").Range("A1")

    outputRow = 1

    For Each word In misspelledWords.keys

        rng.Cells(outputRow, 1).Value = word

        outputRow = outputRow + 1

    Next word

 

End Sub

 

Comments from ChatGPT:

Make sure to adjust the Set rng = ThisWorkbook.Sheets("Sheet1").Range("A1:A100") line to specify the correct range and sheet of your data. The script will output the misspelled words to Sheet2. Adjust the script as necessary.

Run the Script:

Close the VBA editor.

Go back to Excel, click on the "Macros" button in the Developer tab, select "ExtractMisspelledWords", and click "Run".

Review the Output:

Once you run the script, go to Sheet2 and you should see a list of the unique misspelled words that were found in your original data.

Now, you can manually categorize the words into acronyms, surnames, truly misspelled words, etc.

Remember to always make a backup of your Excel file before running any VBA script to prevent any unintended changes or data loss.

 
Posted : 20/10/2023 10:20 am
(@chrisfcorriganoil-com)
Posts: 4
Active Member
Topic starter
 

Thank you Cedric!

 
Posted : 24/10/2023 7:10 am
(@cmckeever)
Posts: 38
Trusted Member
 

My pleasure.  Good luck.

 
Posted : 25/10/2023 9:04 am
Share: