• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 645
  • Last Modified:

Copy both RTF and Text format of word document to clipboard

In the VB.Net code at bottom the clipboard is set to data for both word and notepad

Please indicate the corresponding code for doing this in VB 6.

           Dim dataObject As New System.Windows.Forms.DataObject
           Dim textFile as String
           Dim rtfFIle as String
           ' .....

            dataObject.SetData(System.Windows.Forms.DataFormats.Text, True, textFile)
            dataObject.SetData(System.Windows.Forms.DataFormats.Rtf, True, rtfFile)

            System.Windows.Forms.Clipboard.SetDataObject(New System.Windows.Forms.DataObject(System.Windows.Forms.DataFormats.Text, textFile))
            System.Windows.Forms.Clipboard.SetDataObject(New System.Windows.Forms.DataObject(System.Windows.Forms.DataFormats.Rtf, rtfFile))

Also, please indicate whether it is possible to save a word document into string variables (like textFile and rtfFile above) WITHOUT having to write and then read the word document from a text and RTF file.

  • 2
1 Solution
joexAuthor Commented:
If there is no way to do the above in VB 6, please indicate how to read in an RTF file and copy it to the clipboard in VB 6.

joexAuthor Commented:
It is now clear how to read an RTF file and copy it to the clipboard in VB 6.

Howevever, it would be helpful to know how to write both RTF and text to the clipboard in VB 6 as is shown above in VB.Net.
I think you'll find what you need here:

Use the cCustomClipboard class to write to clipboard in multiple formats.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now