| Private Sub CheckSpelling() Dim oSpellChecker As Object Dim stText As String Dim stNew_Text As String Dim iPosition As Integer On Error GoTo OpenError 'If you want to spell check a group of textboxes in a 'control array.. You can Spell check all of these with a 'do until loop.. There are multiple ways to do this but 'this is a simple one. Set oSpellChecker = CreateObject("Word.Basic") oSpellChecker.FileNew oSpellChecker.Insert ActiveForm.rtfText.Text oSpellChecker.ToolsSpelling oSpellChecker.EditSelectAll stText = oSpellChecker.Selection() oSpellChecker.FileExit 2 If Right$(stText, 1) = vbCr Then _ stText = Left$(stText, Len(stText) - 1) stNew_Text = "" iPosition = InStr(stText, vbCr) Do While iPosition > 0 stNew_Text = stNew_Text & Left$(stText, iPosition - 1) & vbCrLf stText = Right$(stText, Len(stText) - iPosition) iPosition = InStr(stText, vbCr) Loop stNew_Text = stNew_Text & stText ActiveForm.rtfText.Text = stNew_Text MsgBox "Spell Check Complete" Exit Sub OpenError: MsgBox "Error" & Str$(Error.Number) & " opening Word." & vbCrLf & Error.Description End Sub |
Word Spelling 3 |
Freelance ASP PHP web development | Web developer India Web development India| Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design