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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top