-
i have a richtextbox & a command button in the form.
i want to copy the data of the richtextbox to the clipboard.
i am able to do so. but when i changed the formatting of the text in the text box then the data,after copying to the clipboard,looses it's formatting in the clipboard.
i want the data should be appeared in the clipboard with formatted text.
i am waiting 4 reply............!!!!!!!!!!!!!
-
Are you using code to copy and paste?
In that case you should use the vbCFRTF thing. :rolleyes:
To copy RTF text to the Clipboard:
Code:
Call Clipboard.SetText(RichTextBox1.TextRTF, vbCFRTF)
To paste RTF text from the Clipboard:
Code:
RichTextBox1.TextRTF = Clipboard.GetText(vbCFRTF)
-
thanx 4 reply
but i am trying to copy the text to the clipboard & then paste it in the MS word application.
will it work on the Ms word application.
-
Yes!
Yes, it works when you paste it to Word. :rolleyes:
-
Once you have copied something into the clipboard you can paste it into any program - what the receiving program does with it is another matter, but if you are copying text (with or without formatting) from a rich text box, Word should be quite happy about pasting it, since Word is just one big fat buggy rich text box anyway....
-
yes, the problem is still here
i used the code to copy to the clipboard
Clipboard.SetText RichTextBox8.TextRTF, vbCFRTF
it works.
but when i used the code to copy to the MS word
r.Range.InsertAfter Clipboard.GetText(vbcfrtf)
{where r as document}
then what i see on the MSword is.
{\rtf1\ansi\ansicpg1252\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss MS Sans Serif;}}
{\colortbl\red0\green0\blue0;}
\deflang1033\pard\plain\f2\fs17 Ric\plain\f2\fs17\b hTextBox8
\par }
i have the text "richtextbox8" in the text box.
but when i use the "ctrl+v" to paste the text in the word then it pasted formatted text( that is what i want)