Solved

Copy both RTF and Text format of word document to clipboard

Posted on 2006-11-27
6
555 Views
Last Modified: 2010-04-30
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))
            System.Windows.Forms.Clipboard.SetDataObject(dataObject)


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.

Thanks.
0
Comment
Question by:joex
  • 2
6 Comments
 

Author Comment

by:joex
ID: 18024278
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.

Thanks.
0
 

Author Comment

by:joex
ID: 18027269
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.
0
 
LVL 2

Accepted Solution

by:
IanWelch earned 500 total points
ID: 18099173
I think you'll find what you need here:
http://www.vbaccelerator.com/home/VB/Code/Libraries/Clipboard/Customising_Clipboard_Use/article.asp

Use the cCustomClipboard class to write to clipboard in multiple formats.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question