Solved

Copy both RTF and Text format of word document to clipboard

Posted on 2006-11-27
6
537 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now