View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Spell checking a TextBox


Hi,

Here's a cheating way of doing it which corrects the text

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Sheets("Sheet1").Range("a1").Value = TextBox1.Text
Application.EnableEvents = False
Sheets("Sheet1").Range("a1").CheckSpelling
Application.EnableEvents = True
TextBox1.Text = ""
TextBox1.Text = Sheets("Sheet1").Range("a1").Value
Sheets("Sheet1").Range("a1").Value = ""
End Sub


Mike

"Mike H" wrote:

Hi,

I'll be really interested to see if anyone solves this within a textbox and
correct words. You can check the spelling like this but it doesn't correctt

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim word As Variant
For Each word In Split(TextBox1.Text)
If Not Application.CheckSpelling(word) Then
MsgBox word & " isn't a valid word."
End If
Next word
End Sub

Mike

"Patrick C. Simonds" wrote:

Is there any way to spell check the text in a UserForm TextBox when the user
exits the TextBox?