Simple Software Solutions
Hi
There is a way of building in the spell checker found in Word.
On the KeyDown event of the memo field enter the following
Private Sub TxtTxt_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 118 Then 'F7 Function Key
Me.TxtTxt.Text = SpellChecker(Me.TxtTxt.Text)
End If
End Sub
Function SpellChecker(Optional AnyText As String) As String
'Author

avid Crake
'Version :1.5
'Version date :19/04/07
'*********************************************************************************************
'This simple function uses the spell check functionality of Microsoft Word
'When the user presses F7 within the text control this function is called
'The spell checker will appear as it would in Word.
'A new document is created and the incoming text is passed to it - if valid
'Then the spell checker is run against the text and appropriate actions taken - user defined
'The results of these actions are then passed back to the return parameter of this function
'*********************************************************************************************
Dim StrTextIn As String
Dim StrTextOut As String
Dim objword As Object 'create word object variable
'Test for invalid contents
If IsEmpty(AnyText) Or IsNumeric(AnyText) Then
SpellChecker = AnyText
Exit Function
End If
StrTextIn = AnyText
Set objword = CreateObject("Word.Application") 'Create Word instance
With objword 'Use instance
.Visible = False 'Hide Word
.Documents.Add 'Open a new document
.Selection.Text = StrTextIn 'Copy incoming text to then new document
.ActiveDocument.CheckSpelling 'Run the spell Check
StrTextOut = .Selection.Text 'Copy Results back
.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges 'Don't save doc
.Quit 'Exit Word
End With 'End the usage
Set objword = Nothing 'Release Object Variable
SpellChecker = StrTextOut 'Return the results to the calling control
End Function
Code Master
