Results 1 to 6 of 6

Thread: I am in BIG trouble

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    10

    Question

    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............!!!!!!!!!!!!!
    sk

  2. #2
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    Are you using code to copy and paste?
    In that case you should use the vbCFRTF thing.

    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)

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    10
    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.
    sk

  4. #4
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892

    Cool Yes!

    Yes, it works when you paste it to Word.

  5. #5
    Fanatic Member coox's Avatar
    Join Date
    Oct 1999
    Posts
    550
    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....

  6. #6

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    10

    Red face

    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)

    sk

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width