Spell Check

  • Thread starter Thread starter Shawn
  • Start date Start date
S

Shawn

I would like to set a form up so after exiting a text box
it will spell check that text box. How do I limit it to
only check one text box at a time? Module? Code?
THX
 
I have the following code attached to a Spell Check
button. When the user has their cursor in a text box, they
can click this button to check the spelling. You could
modify it to do all the text boxes.

Hope this helps
Sandy

Private Sub cmdSpell_Click()
On Error Resume Next

Dim ctlSpell As Control

' Check the spelling in the selected text box
Set ctlSpell = Screen.PreviousControl
If TypeOf ctlSpell Is TextBox Then
If IsNull(Len(ctlSpell)) Or Len(ctlSpell) = 0 Then
MsgBox "There is nothing to spell check."
ctlSpell.SetFocus
Exit Sub
End If
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
Else
MsgBox "Spell check is not available for this
item."
End If

ctlSpell.SetFocus

End Sub
 
Back
Top