Re: Spell checking textbox on a userform

Tech-Archive recommends: Fix windows errors by optimizing your registry



Several years back (deep in the archives), I found and customized an example
from the web that actually instantiated Word to spell check a userform's
textboxes. It showed the highlighted and misspelled word in context of the
whole text of the textbox, and provided suggested alternatives, just like
Word does. You could Google the words 'Word spell check in Excel', and
probably find the same initial source I had used.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Dale Fye" <dale.fye@xxxxxxxxxx> wrote in message
news:uuSdcibMIHA.4272@xxxxxxxxxxxxxxxxxxxxxxx
Chip,

If I pass this a string (a paragraph), it tells me I have a misspelling,
but not where it is in the string and doesn't offer any opportunity to fix
the misspelling. Using the Range object, one of the options is
[AlwaysSuggest], which at least pops up the corrections dialog. I saw some
code on one of the sites I searched that parsed the paragraph into single
word strings, then ran this code on the string. But I wanted the user to
see the word that was misspelled highlighted in the textbox, like it does
in Access or when you run spellcheck against a Word document. Doesn't
look like that is going to work in Excel; or if it is going to work, I am
going to have to step through the textbox, selecting a word at a time and
then run the application check spelling against it, but won't be able to
get the suggested spelling dialog.

Dale

"Chip Pearson" <chip@xxxxxxxxxxxx> wrote in message
news:752F5C1A-9C86-4DF6-BB06-8DC72ABF34EF@xxxxxxxxxxxxxxxx
You don't have to use a Range. In the code below, put the value whose
spelling you want to test in the variable S.

Sub AAA()
Dim B As Boolean
Dim S As String
S = "coment"
B = Application.CheckSpelling(S) '<<< See help for options
If B = True Then
Debug.Print S & " is properly spelled."
Else
Debug.Print S & " is misspelled."
End If
End Sub

--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)



"Dale Fye" <dale.fye@xxxxxxxxxx> wrote in message
news:5F41169A-D2B3-49BD-92B3-E9D7C743E92A@xxxxxxxxxxxxxxxx
I'm interested in implementing spellchecking on a userform.

I have several textboxes that a user types into which are eventually
written
to cells in an underlying spread***. I've implemented a very
rudimentary
spell checker which fires on the right click in the cell. But I have a
couple of issues with this.

1. The other CheckSpelling method only appears to work with a cell
range,
so I have to point to a cell to be checked. So when a word the
spellchecker
thinks is not valid, is found, the user cannot see this word highlighted
within the text of the textbox because the work*** where the text is
stored
is hidden. In Access, I would hilight the text programmatically, and
use the
docmd.RunCommand method to run the spell checker, which would highlight
the
misspelled word and make recommendations. Is there any way to
accomplish
this in Excel?

2. When the spell checker is done checking the range (individual cell
actually) I have pointed it to, it asks if I want to continue checking
at the
beginning of the ***, which I don't want to do, and don't want to see.
I'm
sure I could turn off the warnings before this line and turn them back
on
again after, but what effect would doing so have on the spell checker?

Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.





.


Quantcast