How to make Grammar Spell Checker on VB6. This is a code shows you how to make a spell checker for your VB programs! It works by calling up MSWord's spell checker to spell check your documents. Grammar Spell Checker feature in one of your programs ? Check this out, it calls up the MSWord's spell checker so you are able to spell check your documents! You need Microsoft Word or better for this code to work. This example spell checks the text in a textbox named "Text1". Put this in a button:
On Error Resume Next
Dim WordSC As Object, pos As Integer
Set WordSC = CreateObject("Word.Basic")
WordSC.AppMinimize
WordSC.FileNewDefault
WordSC.EditSelectAll
WordSC.EditCut
WordSC.Insert Text1.text
WordSC.StartOfDocument
WordSC.ToolsSpelling
WordSC.EditSelectAll
Text1.text = WordSC.Selection
WordSC.FileCloseAll 2
WordSC.AppClose
Set WordSC = Nothing
If Mid(Text1.text, Len(Text1.text), 1) = Chr(13) Then
Text1.text = Mid(Text1.text, 1, Len(Text1.text) - 1)
End If
pos = InStr(Text1.text, Chr(13))
Do While pos <> 0
If Mid(Text1.text, pos + 1, 1) <> Chr(10) Then
Text1.text = Mid(Text1.text, 1, pos) + Chr(10) + Mid(Text1.text, pos + 1)
End If
pos = InStr(pos + 1, Text1.text, Chr(13))
Loop
MsgBox "Spell Check Complete", vbInformation, "Spell Check"
0 comments:
Posting Komentar