470,572 Members | 2,053 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,572 developers. It's quick & easy.

richtextbox loadfile problem

I am trying to spell check a richtextbox. Through code (shown below) I
save the contents of the richtextbox to a rtf file, open the rtf file
in Word, spell check it, save it, and then load the ftf file back into
the ricktextbox using loadfile.

The problem is that the richtextbox seems to remain bound to the rtf
file. If I make a change in the richtextbox after spell checking, the
changes are successfully saved to the database but if the richtextbox
is refreshed, the text from the rtf file is reloaded into the
richtextbox. I have confirmed this by completeing the spell check,
making changes directly in the richtextbox and saving the record,
viewing the saved record from another PC, editing the saved rtf file
that I loaded into the richtextbox while my form with the richtextbox
is open. When I do all that, the changes I made directly in the
richtextbox disappear and the text I edited in Word appear.

I hope I am missing something really obvious. Any help would be
appreciated.

Private Sub Command259_Click()

Dim oWord As Object

Set oWord = CreateObject("Word.Application")

'Save the RTF Box contents to a temporary file
Me.SUMMARY.SaveFile "r:\letters\speller.RTF", rtfRTF

'Open the saved document and spellcheck it
oWord.Documents.Open ("r:\letters\speller.RTF")
oWord.ActiveDocument.SpellingChecked = False
oWord.Options.IgnoreUppercase = False
oWord.ActiveDocument.CheckSpelling

'Save the changes to the RTF file & close
oWord.ActiveDocument.Save
oWord.ActiveDocument.Close
oWord.Quit

'Load the changes back to the rtf text box.
Me.SUMMARY.LoadFile "r:\letters\speller.RTF", rtfRTF

Set oWord = Nothing

MsgBox "Spell Check is complete", _
vbInformation, "Spell Check"
Exit Sub

SpellCheckErr:
MsgBox Err.Description, vbCritical, _
"Spell Check"
Set oWord = Nothing

Nov 13 '05 #1
0 2959

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Yuelin | last post: by
1 post views Thread by Nathan Carroll | last post: by
reply views Thread by OmniTech via .NET 247 | last post: by
1 post views Thread by tulasi | last post: by
reply views Thread by AxOn | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.