Solved

Copy both RTF and Text format of word document to clipboard

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

739 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