Solved

Copy both RTF and Text format of word document to clipboard

Posted on 2006-11-27
6
577 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…
Suggested Courses
Course of the Month11 days, 17 hours left to enroll

623 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