Word type spell checking in Rich text box

A

Al

I have a form with a RichText box control that users will
type a report into. I have code to go behind a command
button to do spell checking but I was wondering if some
brilliant developer has figured out a way to underline
misspelled words, like Word does on the fly? The code I
have is:

Private Sub CmdSpellCheck_Click()
Dim objMsWord As Word.Application
Dim strTemp As String
Set objMsWord = CreateObject("Word.Application")
With objMsWord
.WordBasic.FileNew
.WordBasic.Insert InReport.Text
.WordBasic.ToolsSpelling
.WordBasic.EditSelectAll
.WordBasic.SetDocumentVar "MyVar",
objMsWord.WordBasic.Selection
.Visible = False ' Prevents Word from being shown
End With
strTemp = objMsWord.WordBasic.GetDocumentVar("MyVar")
InReport.Text = Left(strTemp, Len(strTemp) - 1)
objMsWord.Documents.Close (0) ' Close without saving
objMsWord.Quit ' Exit Word
Set objMsWord = Nothing ' Clear object memory
MsgBox "Spell-Check is Complete"
[Forms]![ReportForm].SetFocus ' Return focus To Main
form
End Sub
 

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