By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,188 Members | 1,362 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,188 IT Pros & Developers. It's quick & easy.

richtextbox loadfile problem

P: n/a
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

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

'Save the changes to the RTF file & close

'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

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

Nov 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.