View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Pasted text will not spell check

Hi,

The final code I posted was this after I added a dummy cell to spell check
to ensure the spell checker never went on to check the rest of the worksheet.
I have tested this multiple times and can't find a problem with it. perhaps
you could expalin a bit more about what the issue is.

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim DummyCell As Range
Set DummyCell = Range("IV65536")
Sheets("Sheet1").Range("a1").Value = TextBox1.Text
Application.EnableEvents = False
Union(DummyCell, 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

"Patrick C. Simonds" wrote:

I am trying to spell check the contents of a TextBox on a UserForm.


MikeH was good enough to provide me this code last night which places the
text onto a hidden worksheet and the checks for spelling errors. The problem
is that spell checker will not find spelling error in the text pasted to the
worksheet. as a test (just to make sure the spell checker was running) I
placed a misspelled word in cell F2 and the spell checker did find that
misspelling. I removed the last line of Mike's code so that the text would
be left on the worksheet, just so I could try running the spell checker but
it still would not find the error in the text.




Sheets("Sheet2").Range("a1").Value = TextBox1.Value
Application.EnableEvents = False
Sheets("Sheet2").Range("a1").CheckSpelling
Application.EnableEvents = True
TextBox1.Text = ""
TextBox1.Text = Sheets("Sheet2").Range("a1").Value
Sheets("Sheet2").Range("a1").Value = ""