Spell Checker

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

How can I trigger the spellchecker to spellcheck a
specified text box from the on-click event of a command
button?
 
Dennis said:
How can I trigger the spellchecker to spellcheck a
specified text box from the on-click event of a command
button?

Here's some code by Terry Wickenden that should fit the bill:

' Adaptation by Terry Wickenden of code
' from Microsoft Knowledge Base

Private Sub cmdSpell_Click()
Dim ctlSpell As Control
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
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top