Want to highlight misspelled words, OR ... easily see correct word

S

SoNouveau

I'm doing some work with games. We generate about 2,100 WORDS from a grid of
3 letters by 7 letters:
T O I T S N Y
L R M B O R T
C A N K E A N

Only ONE word (!) is supposed to be correctly spelled when all is said and
done (in this case, LANTERN).

So, I create a list of all the various combinations of letters in Excel, by
concatenation.

Then I cut and paste the 2,100 words into Word--and it does spell checks for
me.

BUT, it's VERY hard to pick out the 1, 2, 3, or 4 CORRECTLY spelled words as
I scan all 2,000 words. (And I do this again and again.)

I want to make sure I don't miss any!!!! So, what I really want is to
highlight in yellow, say, all the incorrect words or ... SOMEHOW, be able to
sort/format/or whatever so that correctly spelled words are easy to pick out
from these long columns of words.

Is that clear AT ALL!?!? LOL
 
P

Peter T. Daniels

Unless your rules involve some other connection than horizontal,
vertical, and diagonal, that grid doesn't give LANTERN. It does,
though, give CANKER. And the name LAMBERT.
 
S

SoNouveau

The rules are simply one letter at a time, left to right. And it does spell
LANTERN. Thanks, though.
 
G

Graham Mayor

Assuming one word per line and the required proofing language applied, you
can highlight the correctly spelled words (according to the Word dictionary)
with the following macro

For i = ActiveDocument.Paragraphs.Count To 1 Step -1
If ActiveDocument.Paragraphs(i).Range.SpellingErrors.Count = 0 Then
ActiveDocument.Paragraphs(i).Range.HighlightColorIndex = wdRed
End If
Next i

or delete the misspelled words with

For i = ActiveDocument.Paragraphs.Count To 1 Step -1
If ActiveDocument.Paragraphs(i).Range.SpellingErrors.Count <> 0 Then
ActiveDocument.Paragraphs(i).Range.Delete
End If
Next i

http://www.gmayor.com/installing_macro.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
P

Peter T. Daniels

So (if only 7-letter words are allowed) this grid also yields CANKERY.

Puzzle magazines have a puzzle in which you reconstruct a quote from a
grid like that (each column contains a bunch of letters over a bunch
of blanks that the letters are to be dropped into), but they never
have as few as three lines -- solving such a puzzle would be trivial.

Unless this is an exercise in an elementary English textbook, surely
the Yahtzee or Boggle rules are needed to make the game interesting.
 
G

Greg Maxey

Peter,

Here you have violated goals and objective statement 6.

6. Bridle your arrogance.

Instead of simply asking the OP what the rules are for the game, you assumed
that you are infallible and the OP is wrong. You open your mouth to attempt
to prove your superiority and dine on crow again.

Unless your rules involve some other connection than horizontal,
vertical, and diagonal, that grid doesn't give LANTERN. It does,
though, give CANKER. And the name LAMBERT.

--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

"It is not the critic who counts, not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man in the arena, whose face is
marred by dust and sweat and blood, who strives valiantly...who knows
the great enthusiasms, the great devotions, who spends himself in a
worthy cause, who at the best knows in the end the triumph of high
achievement, and who at the worst, if he fails, at least fails while
daring greatly, so that his place shall never be with those cold and
timid souls who have never known neither victory nor defeat." - TR
 
G

Greg Maxey

Graham showed you how to highlight words that were not flagged as
spelling errors by Word's dictionary, This piece of code will flag
spelling errors with yellow hightlight and move them to a list at the
end of the document.

Sub SuperFlagErrors()
Dim oSp As Word.Range
Dim oCol As New Collection
Dim i As Long
For Each oSp In ActiveDocument.Range.SpellingErrors
oCol.Add oSp.Text
oSp.Delete
Next oSp
ActiveDocument.Range.InsertAfter vbCr
For i = 1 To oCol.Count
ActiveDocument.Range.InsertAfter oCol(i) & vbCr
Next i
For Each oSp In ActiveDocument.Range.SpellingErrors
oSp.HighlightColorIndex = wdYellow
Next oSp
End Sub

I realize that you didn't ask Peter T. Daniels for his opinion on your
game. Cankery is in fact not listed in the Word dicitionary or it's
dictionary reference. However it is defined in other dicitonaries. If
his fault finding or suggestions have helped you then well and good.
If is arrogance and fault finding has offended you then all all I can
do is apologize on his behalf.

Good luck.
 
P

Peter T. Daniels

OP does not want to highlight the nearly 2100 non-words. OP wants to
highlight the few correctly spelled words.
 
S

Suzanne S. Barnhill

In the matrix the OP presented, there are no correct words; the whole thing
is incorrect (except that, given the spaces between letters, nothing will be
marked as incorrect because it's all single letters). In order to actually
find correct words, you have to sort the wheat from the chaff. A macro to do
this would have to be very sophisticated.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org

Graham showed you how to highlight words that were not flagged as
spelling errors by Word's dictionary, This piece of code will flag
spelling errors with yellow hightlight and move them to a list at the
end of the document.

Sub SuperFlagErrors()
Dim oSp As Word.Range
Dim oCol As New Collection
Dim i As Long
For Each oSp In ActiveDocument.Range.SpellingErrors
oCol.Add oSp.Text
oSp.Delete
Next oSp
ActiveDocument.Range.InsertAfter vbCr
For i = 1 To oCol.Count
ActiveDocument.Range.InsertAfter oCol(i) & vbCr
Next i
For Each oSp In ActiveDocument.Range.SpellingErrors
oSp.HighlightColorIndex = wdYellow
Next oSp
End Sub

I realize that you didn't ask Peter T. Daniels for his opinion on your
game. Cankery is in fact not listed in the Word dicitionary or it's
dictionary reference. However it is defined in other dicitonaries. If
his fault finding or suggestions have helped you then well and good.
If is arrogance and fault finding has offended you then all all I can
do is apologize on his behalf.

Good luck.
 
G

Greg Maxey

Peter said:
OP does not want to highlight the nearly 2100 non-words. OP wants to
highlight the few correctly spelled words.

Peter,

Where is your muzzle? Please wear it.

Why do you post: "OP does not want to highlight the nearly 2100
non-words. OP wants to highlight the few correctly spelled words."

After the OP posts:

"Then I cut and paste the 2,100 words into Word--and it does spell
checks for me.

BUT, it's VERY hard to pick out the 1, 2, 3, or 4 CORRECTLY spelled
words as I scan all 2,000 words. (And I do this again and again.)

I want to make sure I don't miss any!!!! So, what I really want is to
highlight in yellow, say, all the incorrect words or ... SOMEHOW, be
able to sort/format/or whatever so that correctly spelled words are
easy to pick out from these long columns of words."

Read the question and read that the OP says what I "really" want.

I already conceded that Graham's process provides a list of highlighted
correctly spelled words. The macro I provided highlights the mispelled
words in yellow and moves
them to a list at the end of the document. You may be correct, but until
the OP comes back and asks for something else, I will stick to trying to
answer the question asked.

OP, I didn't notice that your words were in a column. If as Graham stated
the list of words consists of one word per line you can modify my earlier
code as follows:

Sub SuperFlagErrors()
Dim oSp As Word.Range
Dim oCol As New Collection
Dim i As Long
For Each oSp In ActiveDocument.Range.SpellingErrors
oCol.Add oSp.Text
oSp.MoveEnd wdCharacter, 1 'Added this line to remove empty paragraph
oSp.Delete
Next oSp
ActiveDocument.Range.InsertAfter vbCr
For i = 1 To oCol.Count
ActiveDocument.Range.InsertAfter oCol(i) & vbCr
Next i
For Each oSp In ActiveDocument.Range.SpellingErrors
oSp.HighlightColorIndex = wdYellow
Next oSp
End Sub

--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

"It is not the critic who counts, not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man in the arena, whose face is
marred by dust and sweat and blood, who strives valiantly...who knows
the great enthusiasms, the great devotions, who spends himself in a
worthy cause, who at the best knows in the end the triumph of high
achievement, and who at the worst, if he fails, at least fails while
daring greatly, so that his place shall never be with those cold and
timid souls who have never known neither victory nor defeat." - TR
 
G

Greg Maxey

Ms. Barnhill,

I was not proposing a macro to find correct or incorrect spelling in the
matrix. The OP indicated that EXCEL is used to sort the wheat from the chaff
and then the list of letter combinations is pasted into Word for spell
checking.

The macro Graham posted probably meets the OP's need. The macro I posted
will also hopefully meet the OP's need. Other than as another display of
his unbridled arrogance or to increase an already bloated post count I don't
really know why Peter T. Daniels posted. I do wish he would stop.
In the matrix the OP presented, there are no correct words; the whole
thing is incorrect (except that, given the spaces between letters,
nothing will be marked as incorrect because it's all single letters).
In order to actually find correct words, you have to sort the wheat
from the chaff. A macro to do this would have to be very
sophisticated.

--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

"It is not the critic who counts, not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man in the arena, whose face is
marred by dust and sweat and blood, who strives valiantly...who knows
the great enthusiasms, the great devotions, who spends himself in a
worthy cause, who at the best knows in the end the triumph of high
achievement, and who at the worst, if he fails, at least fails while
daring greatly, so that his place shall never be with those cold and
timid souls who have never known neither victory nor defeat." - TR
 
P

Peter T. Daniels

Once again, Greg shows that he has great difficulty reading for
content. What OP "really wants" is a way to quickly pick out the tiny
number of real words from a list of 2100 items (ideally there is only
one real word in the entire list), which is _exactly_ what Graham's
routine provides.
 
S

Suzanne S. Barnhill

Yes, I see now that the macro is designed to operate on results rather than
the matrix. I guess I hadn't read enough of the original post to realize
that the OP had already extracted all the possible words.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
http://word.mvps.org
 
G

Greg Maxey

Once again, Peter shows that he has great difficulty reading at all. Worse
he shows again his skill at poking his nose into posts that he should simply
leave alone. Greg concedes in his opening post that Graham's proposed macro
works. He concedes that same thing again in his follow-up post to Ms.
Barnhill.

Greg has also shown a alternative solution to the OP's requirement that just
so happened to do exactly what the OP had asked for. His post was not a
challenge to Graham's. It simply shows a way to highlight spelling errors
with something other than Word's built-in squiggly line.

While Greg's posts might be useful to the OP or others looking for an
alternate method of highlighting spelling errors (e.g., Dr. Kettle), Peter's
have simply been arrogant and argumentative.


Once again, Greg shows that he has great difficulty reading for
content. What OP "really wants" is a way to quickly pick out the tiny
number of real words from a list of 2100 items (ideally there is only
one real word in the entire list), which is _exactly_ what Graham's
routine provides.

--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

"It is not the critic who counts, not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man in the arena, whose face is
marred by dust and sweat and blood, who strives valiantly...who knows
the great enthusiasms, the great devotions, who spends himself in a
worthy cause, who at the best knows in the end the triumph of high
achievement, and who at the worst, if he fails, at least fails while
daring greatly, so that his place shall never be with those cold and
timid souls who have never known neither victory nor defeat." - TR
 
G

Greg Maxey

No harm, no foul. People often make mistakes.

It is those with a belief in their own infallibility, who when obviously
wrong continue in their arguments, that are so irritating.

Yes, I see now that the macro is designed to operate on results
rather than the matrix. I guess I hadn't read enough of the original
post to realize that the OP had already extracted all the possible
words.

--
Greg Maxey

See my web site http://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

"It is not the critic who counts, not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man in the arena, whose face is
marred by dust and sweat and blood, who strives valiantly...who knows
the great enthusiasms, the great devotions, who spends himself in a
worthy cause, who at the best knows in the end the triumph of high
achievement, and who at the worst, if he fails, at least fails while
daring greatly, so that his place shall never be with those cold and
timid souls who have never known neither victory nor defeat." - TR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top