Suppress Spell Checker Completion Msg?

M

MikeC

I have written a procedure that runs a spell check on a given form when the
user clicks on a custom tool bar button. I am now in the process of adding
a new condition that will run the spell check a second time, for a subform,
if the spell check is being run against a particular form.

The spell check completion message displays each time a spell check process
finishes. I would like to suppress the completion message in cases where
the spell check needs to run twice. I've tried using SendKeys, but this
approach has failed.

Is there a way to programatically suppress the message or click the button
in the popup message?

The procedure is below:

Private Sub cmdOK_Click()
On Error GoTo Err_cmdOK_Click

'This sub runs the spell checker against either the current record or
all records
'depending on the option selected by the user. In addition, the spell
checker
'conditionally runs for a subform if the main form is "CCP_PROJECTS".

Dim strForm As String
Dim intTabPage As Integer
Dim intRecNo As Integer

'Set the strForm equal to the form name passed via OpenArgs.
strForm = Forms(Me.OpenArgs).Name

With DoCmd
'Get the current tab page. Will need to set focus to this page
later.
intTabPage = Forms(strForm)!Projects_detail.Value
intRecNo = Forms(strForm).CurrentRecord
If strForm = "CCP_PROJECTS" Then
If Me!grpSpellCheck = 1 Then
'Perform a spell check on the OpenArgs form, CURRENT record
only.
Forms(strForm).SetFocus
.RunCommand acCmdSelectRecord
.RunCommand acCmdSpelling
'Next two lines have no effect.
SendKeys "{ENTER}", True ' Tried False as well.
'Run additional spell check on the subform.
Forms(strForm)!Projects_detail.Pages(5).SetFocus
Forms(strForm)!TimeLine_subform.SetFocus
.RunCommand acCmdSelectRecord
.RunCommand acCmdSpelling
Else
'Perform a spell check on the OpenArgs form, ALL records.
Forms(strForm).SetFocus
.RunCommand acCmdSelectAllRecords
.RunCommand acCmdSpelling
'Run additional spell check on the subform.
Forms(strForm)!Projects_detail.Pages(5).SetFocus
Forms(strForm)!TimeLine_subform.SetFocus
.RunCommand acCmdSelectAllRecords
.RunCommand acCmdSpelling
End If
Else
If Me!grpSpellCheck = 1 Then
'Perform a spell check on the OpenArgs form, CURRENT record
only.
Forms(strForm).SetFocus
.RunCommand acCmdSelectRecord
.RunCommand acCmdSpelling
Else
'Perform a spell check on the OpenArgs form, ALL records.
Forms(strForm).SetFocus
.RunCommand acCmdSelectAllRecords
.RunCommand acCmdSpelling
End If
End If
'Re-display the tab page and record where the user started.
Forms(strForm)!Projects_detail.Pages(intTabPage).SetFocus
.GoToRecord acDataForm, strForm, acGoTo, intRecNo
End With

DoCmd.Close acForm, Me.Name

Exit_cmdOK_Click:
Exit Sub

Err_cmdOK_Click:
If Err.Number = 2046 Then
MsgBox "Error #: " & vbTab & vbTab & Err.Number & vbCrLf _
& "Description: " & vbTab & Err.Description & vbCrLf & vbCrLf _
& "The displayed form must be in EDIT mode before spell check can be
used. " _
& "Try clicking on the Edit button first."
Else
MsgBox "Error #: " & vbTab & vbTab & Err.Number & vbCrLf _
& "Description: " & vbTab & Err.Description
End If
Resume Exit_cmdOK_Click

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

Top