Spelling

  • Thread starter Nick 'The Database Guy'
  • Start date
N

Nick 'The Database Guy'

Hi,

I am fully aware of the F7 spell check in access, and I am also aware
that this can be automated with the statement,

SendKeys "{F7}"

However when you do this you are presented with a message box that
tells you that the spell check is complete, even if the spell check has
made no corrections.

My question is: Is there any way of doing a spell check invisibly? I
realise that this might involve using the windows API.

Thanks In Advance

Nick
 
A

Arvin Meyer [MVP]

Put this code in a standard module and call it from a command button like:

= Spell()

It will spell check every textbox on your form and only show itself if it
thinks there is a misspelled word.

Public Function Spell()
' Arvin Meyer 9/17/1998
' Adapted from code by Terry Wickenden
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
End Function
 
N

Nick 'The Database Guy'

Thanks very much Arvin, that works a treat!
Put this code in a standard module and call it from a command button like:

= Spell()

It will spell check every textbox on your form and only show itself if it
thinks there is a misspelled word.

Public Function Spell()
' Arvin Meyer 9/17/1998
' Adapted from code by Terry Wickenden
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
End Function
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

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

Similar Threads


Top