How to take text from RichTextBox in VB6 to Word object?

R

Ritesh

Hi! There,

I have an application which has RichTextbox in it. Now, I need to produce
word document which has text with the same format as the RichTextBox.

Suppose, user has typed a letter with formatting like Bold, Underline, color
etc. Now, I would like to create a word document which should have the same
text and formatting.

When I take TextRTF to a string variable and write it into word document it
doesn't work. It shows all the formatting characters too.....

This can be done using Clipboard. But, I would like to avoid clipboard if
possible.

Any suggestion(s) or answer(s)

Thanks in advance,
Ritesh.
 
J

Jean-Guy Marcil

Ritesh was telling us:
Ritesh nous racontait que :
Hi! There,

I have an application which has RichTextbox in it. Now, I need to
produce word document which has text with the same format as the
RichTextBox.

Suppose, user has typed a letter with formatting like Bold,
Underline, color etc. Now, I would like to create a word document
which should have the same text and formatting.

When I take TextRTF to a string variable and write it into word
document it doesn't work. It shows all the formatting characters
too.....

This can be done using Clipboard. But, I would like to avoid
clipboard if possible.

Any suggestion(s) or answer(s)

Doesn't the RichTextBox control have a method that allows you to save its
content to an rtf file?

If so, use that to create the Word document (Once you have the rtf file, you
can open it and save it as a doc file, then delete the rtf file.)

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
[email protected]
Word MVP site: http://www.word.mvps.org
 
Top