Vb6 - Spell Check Function
VB Code:
Public Sub SpellCheck(ByRef TextObj As RichTextBox)
Dim objSpellCheck As Object
Dim tmpClipBoardText As String
If TextObj.Text = vbNullString Then Exit Sub
Screen.MousePointer = 13
tmpClipBoardText = Clipboard.GetText
Set objSpellCheck = CreateObject("Word.Application")
objSpellCheck.Visible = False
objSpellCheck.Documents.Add
Clipboard.Clear
Clipboard.SetText TextObj.Text
With objSpellCheck
.Selection.Paste
.ActiveDocument.CheckSpelling
.Visible = False
.ActiveDocument.Select
.Selection.Cut
End With
TextObj.Text = Clipboard.GetText
objSpellCheck.ActiveDocument.Close SaveChanges:=0
objSpellCheck.Quit
Set objSpellCheck = Nothing
Clipboard.SetText tmpClipBoardText
Screen.MousePointer = 0
Exit Sub
End Sub
When using this function for a textbox ---------->
VB Code:
Public Sub SpellCheck(ByRef TextObj As TextBox)
Re: Vb6 - Spell Check Function
Works ok, might want to put the cursor back to where it was before.
Re: Vb6 - Spell Check Function
I don't understand why does it have to mess with the Clipboard ?
Re: Vb6 - Spell Check Function
Because, like in my SpellCheckerâ„¢, by using the clipboard you retain the compatibility of the new lines.
Re: Vb6 - Spell Check Function
So it worked allright for those of you who used it?