Spelling isn't available now

  • Thread starter Thread starter macroapa
  • Start date Start date
M

macroapa

Hi,

I have a form with 2 text boxes and have a button on it to perform
spell checking. My code for the button is below, but it doesn't run
and fails with the message 'Spelling' isn't available now.

Any ideas on where I have gone wrong (the standard spelling macro
fails as well, but i can run toolbar spell check in a field in a
table).

Thanks

Dim ctlSpell As Control
Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False
' Enumerate Controls collection.
For Each ctlSpell In frm.Controls
If TypeOf ctlSpell Is TextBox Then
If Len(ctlSpell) > 0 Then
With ctlSpell
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
End With
DoCmd.RunCommand acCmdSpelling
End If
End If
Next
DoCmd.SetWarnings True
 
Back
Top