I have the following code to use Words spellcheck feature on a RTB. Once you pick the correct word in the spellcheck box and press change I get the error on th efollwoing line
strResult = Left(objDoc.Content, Len(objDoc.Content) - 1)
I tried to use CType() but still complains.
Code:If (Len(t.Text) = 0) Then 'nahhhhhhhhhhh Else 'App.OleRequestPendingTimeout = 999999 objWord = CreateObject("word.Application") objWord.Visible = False Select Case objWord.Version 'Office 2000, xp, 2k3 Case "9.0", "10.0", "11.0", "12.0" objDoc = objWord.Documents.Add(, , 1, True) 'Office 97 Case Else objDoc = objWord.Documents.Add End Select objDoc.Content = t.Text objDoc.CheckSpelling() objWord.Visible = False strResult = Left(objDoc.Content, Len(objDoc.Content) - 1) 'correct the carriage returns strResult = Replace(strResult, Chr(13), Chr(13) & Chr(10)) If t.Text = strResult Then ' There were no spelling errors, so give the user a ' visual signal that something happened MsgBox("The spelling check is complete.", vbInformation + vbOKOnly, "Spelling Complete") End If 'Clean up objDoc.Close(False) objDoc = Nothing objWord.Application.Quit(True) objWord = Nothing ' Replace the selected text with the corrected text. It's important that ' this be done after the "Clean Up" because otherwise there are problems ' with the screen not repainting t.Text = strResult End If


Reply With Quote
