Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Spell checking a TextBox

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Spell checking a TextBox


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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 343
Default Spell checking a TextBox


Mike, Thanks for your time.

My problem now is that spell checker does not spell check what is pasted to
cell A1.

It is an interesting thing, I disabled the line which removes the text from
cell A1 at the end of the routine, and then I tried running spell check on
the sheet and spell check still did not see the spelling errors in the text.
I used this code because it checks the entire sheet so I placed some miss
spelled words in another cell and spell checker did find those misspellings.

"Mike H" wrote in message
...
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?


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default Spell checking a TextBox


Simplest way would be to use a worksheet to pass your textbox value to -
spellcheck & then return corrected text back to textbox.

Something like following may work:

Private Sub CommandButton1_Click()
' use Sheet Range A1 to spell check text
With Sheets("Sheet1").Range("A1")

.Value = TextBox1.Text

.CheckSpelling

TextBox1.Text = .Text

.Value = ""

End With


End Sub
--
jb


"Patrick C. Simonds" wrote:

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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spell Checking Dave[_9_] Excel Programming 4 October 31st 08 05:52 PM
Spell checking textbox on a userform Dale Fye Excel Programming 10 December 28th 07 04:36 PM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
Spell checking without the POP up ... LarryLev[_2_] Excel Programming 1 May 11th 07 05:03 AM


All times are GMT +1. The time now is 09:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"