Reply
 
Thread Tools Display Modes
  #1   Report Post  
Calipboy
 
Posts: n/a
Default 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   Report Post  
Greg Maxey
 
Posts: n/a
Default

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   Report Post  
JoAnn Paules [MSFT MVP]
 
Posts: n/a
Default

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   Report Post  
Jay Freedman
 
Posts: n/a
Default

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   Report Post  
Greg Maxey
 
Posts: n/a
Default

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   Report Post  
Jay Freedman
 
Posts: n/a
Default

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   Report Post  
Joe McGuire
 
Posts: n/a
Default

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   Report Post  
Calipboy
 
Posts: n/a
Default

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   Report Post  
Calipboy
 
Posts: n/a
Default

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   Report Post  
Jay Freedman
 
Posts: n/a
Default

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   Report Post  
Calipboy
 
Posts: n/a
Default

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   Report Post  
Posted to microsoft.public.word.docmanagement
aq4word aq4word is offline
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 285
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
aq4word aq4word is offline
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
aq4word aq4word is offline
external usenet poster
 
Posts: 3
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete first words in all paragraphs Bob Frolek Microsoft Word Help 2 July 27th 05 07:47 AM
My backspace key will not delete entire words wordnerd Microsoft Word Help 1 July 8th 05 03:48 AM
how can i delete words from the dictionary delete phrases Microsoft Word Help 2 January 14th 05 05:37 PM
How to delete misspelled words Sara Microsoft Word Help 1 January 13th 05 12:28 AM
How do you delete words from the dictionary from Office 2000 Library Microsoft Word Help 1 November 29th 04 04:53 PM


All times are GMT +1. The time now is 08:56 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"