How to get a spell checker for a text box in userform

  • Thread starter Thread starter Legacy 146660
  • Start date Start date
L

Legacy 146660

Guest
Hi All<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
What is happening is i have a text box where i type in comments in a user form. A lot of time i make mistakes and spell things wrong. So what i want is while i am typing if i wrongly spell a word can there be a thing like in word tell me that this wrong and show me a option with correct spelling.<o:p></o:p>
or when it tries to put the data in the excel sheet then it will give me an option to correct my spellings.<o:p></o:p>
<o:p></o:p>
I hope i have explained it well but if you want any more explanation then let me know.<o:p></o:p>
<o:p></o:p>
Thanks in advance
Monty
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Quickly one more thing to add i know there is something called "Application.checkspelling" but i dont know how to use this.

Thanks
 
Upvote 0
Easy in Access; can't work it out in Excel!

But you can copy the value into an empty cell somewhere and check that:-
Code:
Range("A1") = TextBox1
Range("A1").CheckSpelling
TextBox1 = Range("A1")
Range("A1").ClearContents
 
Upvote 0
Code:
Sub Chec_1()
Sheet4.TextBox1.Value = Range("A1").Value
With Application.SpellingOptions
        .SuggestMainOnly = True
        .IgnoreCaps = True
    End With
    ' Run a spell check.
Range("A1").CheckSpelling
End Sub
 
Upvote 0
See Vb Help !!
The spellChecker produces a Dialog Box!!
I don't think you can use SpellChecker Directly in a TextBox, but you could use a Helper cell as below.
Code:
Private Sub TextBox1_LostFocus()
Range("A1") = TextBox1
Range("a1").CheckSpelling
TextBox1 = Range("A1")
End Sub
Mick
 
Upvote 0
Not ideal but you could use code like this attached to a button to spellcheck the textbox afterwards:
Code:
    Dim varWords
    Dim n As Long, lngLen As Long
    varWords = Split(Me.TextBox1.Text, " ")
    For n = LBound(varWords) To UBound(varWords)
        If Not Application.CheckSpelling(varWords(n)) Then
            With Me.TextBox1
                .SelStart = lngLen
                .SelLength = Len(varWords(n))
                .SetFocus
            End With
            Exit For
        Else
            lngLen = lngLen + Len(varWords(n)) + 1
        End If
    Next n
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top