Spell checking textbox on a userform

D

Dale Fye

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 spreadsheet. 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 worksheet 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 sheet, 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
 
D

dan dungan

Hi Dale,

I'm not clear about your request. It sounds as though you are using
two different approaches to creating the spell checker.
. . .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,

In Excel 2000 help, I don't see a reference to cell range. How are you
using this method?
. . .it asks if I want to continue checking at the beginning of the
sheet, 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?

What is the code you're using for the rudimentary spell checker?

Dan D
 
C

Chip Pearson

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)
 

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