Make a Spell Checker
Spell checking has always been one of MS Word's greatest features, but now you to can include spell checking into your application with out increasing your file size.
This great example demonstrates how you can setup a spell check by opening Word, copying and pasting the text, spell check it and then close down Word.
Private Function FN_SpellCheck(strTextToVerify As String) _
As Boolean
On Error GoTo FN_SpellCheckErr
Dim oWord As Object
Dim strSelection As String
Set oWord = CreateObject("Word.Basic")
With oWord
.AppMinimize
.FileNewDefault
.EditSelectAll
' done immediately before to minimize possibility of
' user interaction with the clipboard
Clipboard.SetText strTextToVerify, vbCFRTF
.EditPaste
.StartOfDocument
On Error Resume Next
.ToolsSpelling
On Error GoTo 0
.EditSelectAll
.EditCOPY
strSelection = Clipboard.GetText(vbCFRTF)
If Mid(strSelection, Len(strSelection), 1) = Chr(13) Then
strSelection = Mid(strSelection, 1, Len(strSelection) - 1)
End If
If Len(strSelection) > 1 Then
strTextToVerify = strSelection
FN_SpellCheck = True
End If
.FileCloseAll 2
.AppClose
End With
Set oWord = Nothing
Exit Function
0 Comments (click to add your comment)
Networking Solutions
