spell check a textbox

  • Thread starter Thread starter KimberlyC
  • Start date Start date
K

KimberlyC

Hi

I have a text box in my excel spreadsheet.
I need to allow user to run spell check on the text they input into it.
Is there a way to spell check it using code??


Thanks in advance for your help!
Kimberly
 
Hi Kimberly,

Something like this may do what you're looking for:

Private Sub TextBox1_LostFocus()
Dim v As Variant

For Each v In Split(TextBox1.Text)
If Not Application.CheckSpelling(v) Then _
MsgBox "'" & v & "' is not a valid word.", _
vbExclamation
Next v
End Sub

This code should be placed in the Worksheet class module that the TextBox is
on. Just change all instances of "TextBox1" to the name of your TextBox.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Back
Top