Spellcheck a single cell

  • Thread starter Thread starter Howard
  • Start date Start date
H

Howard

I googled this and seems like it should check AK15, which it does, but if spelling is correct it moves on to other items on the sheet. And of all things the next "item" it checks for spelling is the text on a forms button "C. Fmt."
(Fmt not in Dict... suggest FM)

The Msgbox and Exit Sub are my idea of what I would like the code to do.
If spelling in AK15 is correct, tell me and when I click OK it goes away.

Thanks,
Howard

Sub SpellIt()
With Range("AK15")
Call .CheckSpelling("CUSTOM.DIC", False, True, 2057)
'Msgbox "Spelling is correct"
' Exit Sub
End With
End Sub
 
Hi Howard,

Am Sat, 8 Jun 2013 23:28:39 -0700 (PDT) schrieb Howard:
Sub SpellIt()
With Range("AK15")
Call .CheckSpelling("CUSTOM.DIC", False, True, 2057)
'Msgbox "Spelling is correct"
' Exit Sub
End With
End Sub

try:
Sub SpellIt()
Dim Ans As String
Ans = Range("AK34").CheckSpelling("CUSTOM.DIC", False, True, 2057)
MsgBox Ans
End Sub


Regards
Claus Busch
 
Hi Howard,

Am Sun, 9 Jun 2013 10:33:04 +0200 schrieb Claus Busch:
Sub SpellIt()
Dim Ans As String
Ans = Range("AK34").CheckSpelling("CUSTOM.DIC", False, True, 2057)
MsgBox Ans
End Sub

Ans is boolean and not string:

Sub SpellIt()
Dim Ans As Boolean
Ans = Range("AK34").CheckSpelling("CUSTOM.DIC", False, True, 1031)
If Ans = True Then
MsgBox "Spelling correct"
Else
MsgBox "Spelling incorrect"
End If
End Sub

or:
Sub SpellIt2()
Dim Ans As Boolean
Ans = Application.CheckSpelling(Range("AK34").Text, _
"CUSTOM.DIC", False)
If Ans = True Then
MsgBox "Spelling correct"
Else
MsgBox "Spelling incorrect"
End If
End Sub


Regards
Claus Busch
 
Hi again,

Am Sun, 9 Jun 2013 11:00:17 +0200 schrieb Claus Busch:
Sub SpellIt2()
Dim Ans As Boolean
Ans = Application.CheckSpelling(Range("AK34").Text, _
"CUSTOM.DIC", False)
If Ans = True Then
MsgBox "Spelling correct"
Else
MsgBox "Spelling incorrect"
End If
End Sub

with Application.CheckSpelling you will get not suggestions from
CUSTOM.DIC


Regards
Claus Busch
 
Thanks, Claus.

I like the way the first one works, with the suggestion box, with English(UK).
However, if I use this for English(US), it only returns Msgbox True regardless of correct or incorrect spelling.

Ans = Range("AK34").CheckSpelling("CUSTOM.DIC", False, True, 1031)

Sub SpellIt()
Dim Ans As String
Ans = Range("AK34").CheckSpelling("CUSTOM.DIC", False, True, 2057)
'Ans = Range("AK34").CheckSpelling("CUSTOM.DIC", False, True, 1031)
MsgBox Ans
End Sub

Howard
 
Hi Howard,

Am Sun, 9 Jun 2013 02:36:11 -0700 (PDT) schrieb Howard:
I like the way the first one works, with the suggestion box, with English(UK).
However, if I use this for English(US), it only returns Msgbox True regardless of correct or incorrect spelling.

sorry, I didn't change the language after testing. 1031 is German


Regards
Claus Busch
 
Hi Howard,

Am Sun, 9 Jun 2013 02:36:11 -0700 (PDT) schrieb Howard:
Sub SpellIt()
Dim Ans As String
Ans = Range("AK34").CheckSpelling("CUSTOM.DIC", False, True, 2057)
'Ans = Range("AK34").CheckSpelling("CUSTOM.DIC", False, True, 1031)
MsgBox Ans
End Sub

if you check by "CUSTOM.DIC" you have to use the language of CUSTOM.DIC.
If you want to check for another language (e.g. German) try:
Range("AK34").CheckSpelling SpellLang:=1031


Regards
Claus Busch
 
Hi Howard,



Am Sun, 9 Jun 2013 02:36:11 -0700 (PDT) schrieb Howard:











if you check by "CUSTOM.DIC" you have to use the language of CUSTOM.DIC.

If you want to check for another language (e.g. German) try:

Range("AK34").CheckSpelling SpellLang:=1031





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2

Thanks, Claus. I confused German(Standard) 1031 with English(US) 1033 and English(UK) 2057.

Works just fine now that I have my geography straightened out.

Thanks again.

Regards,
Howard
 
Hi Howard,

Am Sun, 9 Jun 2013 03:40:32 -0700 (PDT) schrieb Howard:
I confused German(Standard) 1031 with English(US) 1033 and English(UK) 2057.

Works just fine now that I have my geography straightened out.

if you get the suggestion window and you click "Ignore..." the spelling
will be accepted as correct. If you click "Cancel" you get incorrect.


Regards
Claus Busch
 
Hi Howard,



Am Sun, 9 Jun 2013 03:40:32 -0700 (PDT) schrieb Howard:






if you get the suggestion window and you click "Ignore..." the spelling

will be accepted as correct. If you click "Cancel" you get incorrect.





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2

Claus,

On a test sheet your solution works just fine.

In the test cell (AK15) I enter the word "sceince", run the code and it offers suggestion just as I want. Pick suggestion > = "science" > OK > Msgbox = "True" > OK. All is fine.

On the actual (non test) worksheet with same code and same cell address, for some reason it insists on including the Caption of a Forms button that has
"C. Fmt." (a button that calls a conditional formatting macro.)

If I eliminate the button, all is good. I have moved the button around on the sheet to see if that made any difference, but the code finds it, if it exists. I tried a new button and entered the word "Doneky" and the code offered up "Donkey" as a suggestion. Accept Donkey and then it goes to AK15 where I have "Sceince" and does its job there. If Donkey is spelled correctly on the button then the code goes straight the AK15 cell and does its jobthere.

Sub SpellItAK()
Dim Ans As String
Ans = Range("AK15").CheckSpelling("CUSTOM.DIC", False, True, 1033)
MsgBox Ans
End Sub


I have other buttons on the sheet but they are spelled correctly and one has Ctrl-l on it but is not affected by the spell check code.
Any ideas?

Howard
 
Hi Howard,

Am Sun, 9 Jun 2013 04:35:14 -0700 (PDT) schrieb Howard:

On the actual (non test) worksheet with same code and same cell address, for some reason it insists on including the Caption of a Forms button that has
"C. Fmt." (a button that calls a conditional formatting macro.)

If I eliminate the button, all is good. I have moved the button around on the sheet to see if that made any difference, but the code finds it, if it exists. I tried a new button and entered the word "Doneky" and the code offered up "Donkey" as a suggestion. Accept Donkey and then it goes to AK15 where I have "Sceince" and does its job there. If Donkey is spelled correctly on the button then the code goes straight the AK15 cell and does its job there.

I tested it with ActiveX-Button and Forms Button, but the macro didn't
check the button. Even if the button calls the macro it don't check it.
I have no idea.


Regards
Claus Busch
 
Hi Howard,



Am Sun, 9 Jun 2013 04:35:14 -0700 (PDT) schrieb Howard:









I tested it with ActiveX-Button and Forms Button, but the macro didn't

check the button. Even if the button calls the macro it don't check it.

I have no idea.





Regards

Claus Busch

--

Win XP PRof SP2 / Vista Ultimate SP2

Office 2003 SP2 /2007 Ultimate SP2

I thank you for giving it a look. Weird, but easy enough to work around.

Regards,
Howard
 
Back
Top