473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 3202

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Yuelin | last post by:
Hi there How can I read a RTF file into a RichTextBox control without the original format being lost? And how can I save the text entered in a RichTextBox into a RTF file without the original...
1
by: Yuelin | last post by:
Hi, thanks Noah for your advice. I wrote following to read a rich text file into a RichTextBox control: this.m_textBox.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.RichText); ...
1
by: Nathan Carroll | last post by:
In an mdi environment I constructed a child for with a richtextbox control that is used to load .rtf's. This works fine on the intiatial load of the form but when for is closed and reopened later...
0
by: y2k692hu | last post by:
Hello I am trying to run this and I keep getting a "SystemNullReferenceException: Object reference not set to instance of an object" error. I have three menu items bold, italic and underline. When i...
0
by: OmniTech via .NET 247 | last post by:
I am having trouble updating lines in a richtextbox. The rtb.lines.setvalue("text", linenumber) runs, but does not update the control in the form. The code follows... This apps automatically...
1
by: tulasi | last post by:
I am placing textbox controls and combo box controls on richtext box and 2 command buttons on form control. after executing the application i'll place some text into textbox controls and select a...
0
by: AxOn | last post by:
Hi! I'm having trouble creating a save funktion. How can I save the contens of a new richTextBox that is created from an "external" class file? The open funktion looks like this: public void...
0
by: bettiahamit | last post by:
here i created sequence no. with every paragraph line .. like... <p local_id = P-100>aaaaaaaaaaaaaaaaaaaaaaaaa<\p> <p local_id = P-101>bbbbbbbbbbbbbbbbbbbbbbbbb<\p> <p local_id =...
3
Shinobi
by: Shinobi | last post by:
c#.net I have 2 forms. richtextbox1 is placed in form1. listbox1 is used in form2. selectedindex of listbox1 is passing path to form1. by using this path i am trying to load richtextbox1 using...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.