Setup Spell Checking on Userform textboxes

  • Thread starter Thread starter Charles
  • Start date Start date
C

Charles

Hi is it possible to have a button on a userform to enable
the user to check spelling in textboxes?.
TIA
Charles
 
You can use Excel's built-in spell checking through VBA
with the CheckSpelling method. There is one catch: it
only checks a word at a time unless you use it on a range
or worksheet. So you have two choices: parse your textbox
into words and check each word (and design your own user
interface if errors found!) or put the textbox contents
temporarily into some cell on your worksheet and check
that cell. The code below accomplishes the 2nd method
(easier but not as elegant):

Private Sub CommandButton1_Click()


Range("TempCell") = Me.TextBox1
Range("TempCell").CheckSpelling
Me.TextBox1 = Range("TempCell")

Range("TempCell") = ""

End Sub
 
Back
Top