Converting Access97-AccessXP, got "Can't find macro Spell Checker.

G

Guest

I converted an Access97 database to AccessXP. I tried to open one of the
forms and I keep getting the message "Can't find the macro "Spell Checker.""
I tried commenting out lines that do a RunCommand acCmdSpelling. I also
deleted the pages that have text boxes on them. Nothing seems to help.
 
B

Bryan Hughes

Try this
Create a module called basSpellCheck
Place this code into it
***************************************************
Public Function fnCheckSpelling(ctl As Control, blnUseWordSpellChecker As
Boolean) As Boolean
On Error GoTo ErrorHandler
mstrSubProcName = "fnCheckSpelling()"
'This procedure checks spelling with either the Word Spell
'Checking/Grammer Checking window or the Access default Spell
'Checking window only. Both methods require Word 97 or later
'to work, because the dictonary is used. The word method
'gives more functionality with the addition of the
'grammer checking capability.

Dim wrdApp As Object
Dim wrdDoc As Object


'This function is meant for textbox controls only
Select Case ctl.ControlType
Case acTextBox
If (ctl.Enabled = False) Or (ctl.Locked = True) Then
'Text Control cannot be updated
GoTo ErrorHandlerExit
ElseIf IsNull(ctl) = True Then
'Nothing to check
GoTo ErrorHandlerExit
End If
Case Else
GoTo ErrorHandlerExit
End Select

If blnUseWordSpellChecker = True Then
'Use Word default spell checker (with grammer checker)
Set wrdApp = CreateObject("Word.Application")

wrdApp.Visible = False
Set wrdDoc = wrdApp.Documents.Add

wrdApp.Selection.Text = ctl

'wrdApp.WindowState = 2 'wdWindowStateMinimize
wrdApp.Visible = False
wrdApp.Dialogs(828).Show
'wdDialogToolsSpellingAndGrammer = 828
wrdApp.Visible = False


'The cancel button on the word spell checker was not pressed
If Len(wrdApp.Selection.Text & "") <> 1 Then
ctl = wrdApp.Selection.Text

wrdApp.ActiveDocument.Close 0 'wdDoNotSaveChanges = 0
Set wrdDoc = Nothing
wrdApp.Quit
Set wrdApp = Nothing

fnCheckSpelling = True
MsgBox "Spell check is complete.", vbInformation
End If
Else 'Use Access's default spell checker (without grammer)
ctl.SetFocus
ctl.SelStart = 0
ctl.SelLength = Len(ctl.Text & "")
If ctl.SelLength <> 0 Then

RunCommand acCmdSpelling
ctl.SelLength = 0
fnCheckSpelling = True
End If
End If



ErrorHandlerExit:
On Error Resume Next

If Not (wrdApp Is Nothing) Then
If Not (wrdDoc Is Nothing) Then
wrdApp.ActiveDocument.Close = 0 'wdDoNotSaveChanges = 0
Set wrdDoc = Nothing
End If
wrdApp.Quit
Set wrdApp = Nothing
End If
Exit Function

ErrorHandler:
gstrErrMsg = "Procedure: " & mstrModuleName & vbCrLf
gstrErrMsg = gstrErrMsg & "Procedure: " & mstrSubProcName & vbCrLf
gstrErrMsg = gstrErrMsg & "Error No: " & Err.Number
gstrErrMsg = gstrErrMsg & "; Description: " & Err.Description & vbCrLf
gstrErrMsg = gstrErrMsg & "Source: " & Err.Source
MsgBox gstrErrMsg, pintErrDialog, pstrErrTitle
Err.Clear
Resume ErrorHandlerExit
End Function
**********************************************

Then at the top of the form your wish to spell check add this to to the
general dec area
'Note: Uncomment the mode you want to support
Const conSpellCheckOption = 1 'Spell Check
'Const conSpellCheckOption = 2 'Word Grammer
'Const conSpellCheckOption = 3 'Word Grammer with options

Then add a command button for the spellcheck with this code behind it
Private Sub cmdSpell_Check_Click()
On Error GoTo ErrorHandler
mstrProcName = "cmdSpell_Check_Click()"
Dim intTemp As Integer

If (Len(Me!txtComments & "") = 0) Then
Exit Sub
Else
Select Case conSpellCheckOption
Case 1 'Use default spell checker
intTemp = fnCheckSpelling(Me!txtComments, False)
Case 2, 3 'Use MS Word grammer checker
intTemp = fnCheckSpelling(Me!txtComments, True)
End Select
End If
ErrorHandlerExit:
Exit Sub

ErrorHandler:
gstrErrMsg = "Form: " & mstrFormName & vbCrLf
gstrErrMsg = gstrErrMsg & "Procedure: " & mstrProcName & vbCrLf
gstrErrMsg = gstrErrMsg & "Error No: " & Err.Number
gstrErrMsg = gstrErrMsg & "; Description: " & Err.Description & vbCrLf
gstrErrMsg = gstrErrMsg & "Source: " & Err.Source
MsgBox gstrErrMsg, pintErrDialog, pstrErrTitle
Err.Clear
Resume ErrorHandlerExit
End Sub

Hope this helps
Bryan
 

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