Is there a way to put Rich Text formatted text into Word.Basic creation which will keep the RTF formats so I can spell check the text, select it and then put it back into the rich text box? here's my code currently which works, but it uses copy and paste and I was trying to see if there was a way around using them. I tried to do .Insert strTextToVerify instead of pasting the string fromt he clipboard but it pasted the actually formatting as part of the string, which screws up the spell checker.
here's what i got so far, though i'd rather not be using copy and paste.
VB Code:
Private Function SpellCheck(ByVal strTextToVerify As String) As String 'This function uses word to spell check the passed string Dim sNewText As String Dim oWord As Object Set oWord = CreateObject("Word.Basic") Clipboard.Clear With oWord .AppShow .FileNew Clipboard.SetText strTextToVerify, vbCFRTF .EditPaste .ToolsSpelling .EditSelectAll .EditCopy sNewText = Clipboard.GetText(vbCFRTF) oWord.FileClose 2 oWord.FileExit End With


Reply With Quote