Home |
Search |
Today's Posts |
#1
|
|||
|
|||
How do I delete all words that are mispelled in a document?
I have a document with 50k words and I would like to delete all the words
that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#2
|
|||
|
|||
You could try running a macro something like this:
Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For Each myErr In myErrors myErr.Delete Next End If End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Calipboy wrote: I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#3
|
|||
|
|||
Wouldn't it be better to correct the spelling?
-- JoAnn Paules MVP Microsoft [Publisher] "Calipboy" wrote in message ... I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#4
|
|||
|
|||
On Mon, 8 Aug 2005 15:18:03 -0700, "Calipboy"
wrote: I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? Use this macro (see http://www.gmayor.com/installing_macro.htm): Sub DeleteAllMisspelledWords() Dim myErrors As ProofreadingErrors Dim myErr As Range Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For Each myErr In myErrors myErr.Delete Next End If End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org |
#5
|
|||
|
|||
Jay,
So you don't like how I name my macros :-) -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Jay Freedman wrote: On Mon, 8 Aug 2005 15:18:03 -0700, "Calipboy" wrote: I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? Use this macro (see http://www.gmayor.com/installing_macro.htm): Sub DeleteAllMisspelledWords() Dim myErrors As ProofreadingErrors Dim myErr As Range Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For Each myErr In myErrors myErr.Delete Next End If End Sub |
#6
|
|||
|
|||
Hey, I had to do *something* creative while I was copying code out of
the Help topic. ;-) -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org On Mon, 8 Aug 2005 20:05:37 -0400, "Greg Maxey" wrote: Jay, So you don't like how I name my macros :-) -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Jay Freedman wrote: On Mon, 8 Aug 2005 15:18:03 -0700, "Calipboy" wrote: I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? Use this macro (see http://www.gmayor.com/installing_macro.htm): Sub DeleteAllMisspelledWords() Dim myErrors As ProofreadingErrors Dim myErr As Range Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For Each myErr In myErrors myErr.Delete Next End If End Sub |
#7
|
|||
|
|||
Just a thought. Isn't your text going to look a bit funny with all those
words missing? Wouldn't you want to replace them with something? I am trying to imagine, say, the Gettysburg Address after these macros rip out any fancy words Abe used that might have triggered the wavy red lines. Would it be sort of like "And seven years ago our brought on this continent a new nation in liberty and to the that all men are created." Sounds odd. Heck of a lot simpler, though. "Calipboy" wrote in message ... I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#8
|
|||
|
|||
thannk you guys! I will try the Macros. This is actually a word list and I
have eliminate words that are not recognized by the Word Dictionary. No sentences or anything like that just thousands and thousands of words. I started to do a few pages then quickly realized there had to be a better way. "Joe McGuire" wrote: Just a thought. Isn't your text going to look a bit funny with all those words missing? Wouldn't you want to replace them with something? I am trying to imagine, say, the Gettysburg Address after these macros rip out any fancy words Abe used that might have triggered the wavy red lines. Would it be sort of like "And seven years ago our brought on this continent a new nation in liberty and to the that all men are created." Sounds odd. Heck of a lot simpler, though. "Calipboy" wrote in message ... I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#9
|
|||
|
|||
It worked!! Just as a note...it kept locking up when I tried it on the full
doc (250 pages...856k), but I divided the doc into 4 smaller parts and then it worked just fine. Would anyone know how to delete words that don't have Synonyms? In other words a word that when you right click on shows nothing under synonyms. "Calipboy" wrote: thannk you guys! I will try the Macros. This is actually a word list and I have eliminate words that are not recognized by the Word Dictionary. No sentences or anything like that just thousands and thousands of words. I started to do a few pages then quickly realized there had to be a better way. "Joe McGuire" wrote: Just a thought. Isn't your text going to look a bit funny with all those words missing? Wouldn't you want to replace them with something? I am trying to imagine, say, the Gettysburg Address after these macros rip out any fancy words Abe used that might have triggered the wavy red lines. Would it be sort of like "And seven years ago our brought on this continent a new nation in liberty and to the that all men are created." Sounds odd. Heck of a lot simpler, though. "Calipboy" wrote in message ... I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#10
|
|||
|
|||
Ooh, a puzzle poser! :-)
Public Sub NoSynonyms() Dim oWord As Range Application.ScreenUpdating = False For Each oWord In ActiveDocument.Words With oWord If .SynonymInfo.MeaningCount = 0 Then .Delete End If End With Next oWord Application.ScreenUpdating = True End Sub Careful, though -- this one is going to run only slightly less than forever. You'll probably have to split your document into even more pieces. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org On Tue, 9 Aug 2005 16:18:01 -0700, "Calipboy" wrote: It worked!! Just as a note...it kept locking up when I tried it on the full doc (250 pages...856k), but I divided the doc into 4 smaller parts and then it worked just fine. Would anyone know how to delete words that don't have Synonyms? In other words a word that when you right click on shows nothing under synonyms. "Calipboy" wrote: thannk you guys! I will try the Macros. This is actually a word list and I have eliminate words that are not recognized by the Word Dictionary. No sentences or anything like that just thousands and thousands of words. I started to do a few pages then quickly realized there had to be a better way. "Joe McGuire" wrote: Just a thought. Isn't your text going to look a bit funny with all those words missing? Wouldn't you want to replace them with something? I am trying to imagine, say, the Gettysburg Address after these macros rip out any fancy words Abe used that might have triggered the wavy red lines. Would it be sort of like "And seven years ago our brought on this continent a new nation in liberty and to the that all men are created." Sounds odd. Heck of a lot simpler, though. "Calipboy" wrote in message ... I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#11
|
|||
|
|||
I appreciate it Jay, you sure know WORD well!.....and thanks for the warning
on CPU usage. "Jay Freedman" wrote: Ooh, a puzzle poser! :-) Public Sub NoSynonyms() Dim oWord As Range Application.ScreenUpdating = False For Each oWord In ActiveDocument.Words With oWord If .SynonymInfo.MeaningCount = 0 Then .Delete End If End With Next oWord Application.ScreenUpdating = True End Sub Careful, though -- this one is going to run only slightly less than forever. You'll probably have to split your document into even more pieces. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org On Tue, 9 Aug 2005 16:18:01 -0700, "Calipboy" wrote: It worked!! Just as a note...it kept locking up when I tried it on the full doc (250 pages...856k), but I divided the doc into 4 smaller parts and then it worked just fine. Would anyone know how to delete words that don't have Synonyms? In other words a word that when you right click on shows nothing under synonyms. "Calipboy" wrote: thannk you guys! I will try the Macros. This is actually a word list and I have eliminate words that are not recognized by the Word Dictionary. No sentences or anything like that just thousands and thousands of words. I started to do a few pages then quickly realized there had to be a better way. "Joe McGuire" wrote: Just a thought. Isn't your text going to look a bit funny with all those words missing? Wouldn't you want to replace them with something? I am trying to imagine, say, the Gettysburg Address after these macros rip out any fancy words Abe used that might have triggered the wavy red lines. Would it be sort of like "And seven years ago our brought on this continent a new nation in liberty and to the that all men are created." Sounds odd. Heck of a lot simpler, though. "Calipboy" wrote in message ... I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#12
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I delete all words that are mispelled in a document?
Hi Greg
I know it's a long time since your post below. (I'm using MVB 6.5 with Word 2007. Maybe therein lies the problem). I'm trying to apply your macro to 75 files containing around 3,000 words each (i.e. sub-files of a Scrabble dictionary, which, thanks to Doug Robbins, I was successfully able to split) The macro works most of the time (I'm up to file 31 after several retries). I get repeatedly the VB error ' Run-time error '4608' Application-defined or Object-defined error. On clicking 'debug' it points to the 'Next' statement in your macro as listed below. I'm using exactly that coding. Would appreciate any 'get-arounds' just to get me through the 75 files. (And of course, thanks for the macro anyway) Brian "Greg Maxey" wrote: You could try running a macro something like this: Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For Each myErr In myErrors myErr.Delete Next End If End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Calipboy wrote: I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#13
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I delete all words that are mispelled in a document?
I don't know what MVB is.
You might try: Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Dim i As Long Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For i = myErrors.Count To 1 Step -1 MsgBox myErrors(i).Text myErrors(i).Delete Next i End If End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. aq4word wrote: Hi Greg I know it's a long time since your post below. (I'm using MVB 6.5 with Word 2007. Maybe therein lies the problem). I'm trying to apply your macro to 75 files containing around 3,000 words each (i.e. sub-files of a Scrabble dictionary, which, thanks to Doug Robbins, I was successfully able to split) The macro works most of the time (I'm up to file 31 after several retries). I get repeatedly the VB error ' Run-time error '4608' Application-defined or Object-defined error. On clicking 'debug' it points to the 'Next' statement in your macro as listed below. I'm using exactly that coding. Would appreciate any 'get-arounds' just to get me through the 75 files. (And of course, thanks for the macro anyway) Brian "Greg Maxey" wrote: You could try running a macro something like this: Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For Each myErr In myErrors myErr.Delete Next End If End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Calipboy wrote: I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#14
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I delete all words that are mispelled in a document?
Thanks Greg for the rapid response. Sorry about the MVB abbreviation of my
own making. (Microsoft Visual Basic). I don't come back to you lightly. I've been trying for days to batch your coding for the now 137 X 20K files of around 1,500 words each. (50% of which have spelling errors or not English). It works, as is, fine. i.e. open a file and run the macro on the active file (I've REM'd the two MSG's to stop having to answer the screen messages). That is, I open a target file manually in Word 2007 and launch the macro. The macro continues with the then active file which then gets the red underlines automatically which the macro deletes. However, when I insert a DOCUMENTS.OPEN statement (to facilitate batching the 137 files for processing) it simply fails to do the red underlining and deleting. That is, the macro completes very quickly having done nothing. The modified code is:- Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Dim i As Long Documents.Open FileName:="""c:\users\bhep\documents\scrabble75fil es\English (UK)001.srb""" Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then REM MsgBox "No spelling errors found." Else For i = myErrors.Count To 1 Step -1 REM MsgBox myErrors(i).Text myErrors(i).Delete Next i End If ActiveDocument.Save ActiveDocument.Close End Sub I can't get my head around looping at the moment so I'll simply include the above coding 137 times with filenames ....001.srb to ....137.srb if I can get it working. Very much appreciate your help so far. How can I force the spellchecker to activate. i.e. do its thing of red underlining to allow the deletes to take place? Best regards Brian "Greg Maxey" wrote: I don't know what MVB is. You might try: Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Dim i As Long Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For i = myErrors.Count To 1 Step -1 MsgBox myErrors(i).Text myErrors(i).Delete Next i End If End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. aq4word wrote: Hi Greg I know it's a long time since your post below. (I'm using MVB 6.5 with Word 2007. Maybe therein lies the problem). I'm trying to apply your macro to 75 files containing around 3,000 words each (i.e. sub-files of a Scrabble dictionary, which, thanks to Doug Robbins, I was successfully able to split) The macro works most of the time (I'm up to file 31 after several retries). I get repeatedly the VB error ' Run-time error '4608' Application-defined or Object-defined error. On clicking 'debug' it points to the 'Next' statement in your macro as listed below. I'm using exactly that coding. Would appreciate any 'get-arounds' just to get me through the 75 files. (And of course, thanks for the macro anyway) Brian "Greg Maxey" wrote: You could try running a macro something like this: Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For Each myErr In myErrors myErr.Delete Next End If End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Calipboy wrote: I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
#15
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
How do I delete all words that are mispelled in a document?
Hi Greg - Oops, forget my last post. Problem lay with language environment.
As I live in Switzerland I'd activated German and French as well as US and UK English. A 'wrong' word seems to have sent the spellchecker off looking for a German reference dictionary, which I don't have. Configuring out the German and French languages was the solution. Your macro (batched) is into its 15th hour - 240 hours to go (well I only have a 1.8Ghz X 1Gb on my Vista pc). At the end I'll have a Microsoft clean Scrabble dictionary. All I'll then need to do is anglicise it! Thanks for your help. Kind regards Brian "aq4word" wrote: Thanks Greg for the rapid response. Sorry about the MVB abbreviation of my own making. (Microsoft Visual Basic). I don't come back to you lightly. I've been trying for days to batch your coding for the now 137 X 20K files of around 1,500 words each. (50% of which have spelling errors or not English). It works, as is, fine. i.e. open a file and run the macro on the active file (I've REM'd the two MSG's to stop having to answer the screen messages). That is, I open a target file manually in Word 2007 and launch the macro. The macro continues with the then active file which then gets the red underlines automatically which the macro deletes. However, when I insert a DOCUMENTS.OPEN statement (to facilitate batching the 137 files for processing) it simply fails to do the red underlining and deleting. That is, the macro completes very quickly having done nothing. The modified code is:- Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Dim i As Long Documents.Open FileName:="""c:\users\bhep\documents\scrabble75fil es\English (UK)001.srb""" Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then REM MsgBox "No spelling errors found." Else For i = myErrors.Count To 1 Step -1 REM MsgBox myErrors(i).Text myErrors(i).Delete Next i End If ActiveDocument.Save ActiveDocument.Close End Sub I can't get my head around looping at the moment so I'll simply include the above coding 137 times with filenames ....001.srb to ....137.srb if I can get it working. Very much appreciate your help so far. How can I force the spellchecker to activate. i.e. do its thing of red underlining to allow the deletes to take place? Best regards Brian "Greg Maxey" wrote: I don't know what MVB is. You might try: Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Dim i As Long Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For i = myErrors.Count To 1 Step -1 MsgBox myErrors(i).Text myErrors(i).Delete Next i End If End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. aq4word wrote: Hi Greg I know it's a long time since your post below. (I'm using MVB 6.5 with Word 2007. Maybe therein lies the problem). I'm trying to apply your macro to 75 files containing around 3,000 words each (i.e. sub-files of a Scrabble dictionary, which, thanks to Doug Robbins, I was successfully able to split) The macro works most of the time (I'm up to file 31 after several retries). I get repeatedly the VB error ' Run-time error '4608' Application-defined or Object-defined error. On clicking 'debug' it points to the 'Next' statement in your macro as listed below. I'm using exactly that coding. Would appreciate any 'get-arounds' just to get me through the 75 files. (And of course, thanks for the macro anyway) Brian "Greg Maxey" wrote: You could try running a macro something like this: Sub Test() Dim myErrors As ProofreadingErrors Dim myErr As Range Set myErrors = ActiveDocument.Range.SpellingErrors If myErrors.Count = 0 Then MsgBox "No spelling errors found." Else For Each myErr In myErrors myErr.Delete Next End If End Sub -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. Calipboy wrote: I have a document with 50k words and I would like to delete all the words that are underlined red or not recognized by the dictionary automatically. Going one by one is taking much too long!! Anyone know how? |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Delete first words in all paragraphs | Microsoft Word Help | |||
My backspace key will not delete entire words | Microsoft Word Help | |||
how can i delete words from the dictionary | Microsoft Word Help | |||
How to delete misspelled words | Microsoft Word Help | |||
How do you delete words from the dictionary from Office 2000 | Microsoft Word Help |