?
Solved

How to Copy and Paste RTF Formatted Text into a Word Document

Posted on 2008-11-06
9
Medium Priority
?
628 Views
Last Modified: 2013-11-27
Hi
I have an Access 2000 database that merges phrases into a Word template using Word automation. I want to use RTF formatting so have decided to use copying and pasting from the clipboard within one of my routines(this is due to having tried saving RTF formatted text and not being able to bring it back formatted). I am having trouble copying RTF formatted text to the clipboard using VBA. I have tried MS's Clipboard_SetText routines and others but they just bring back the whole of the RTF code (e.g. {\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman\fprq \fcharset0 Times New Roman;}{\f1\fnil\fcharset0 MS Sans Serif;}} \viewkind4\uc1\pard\lang2057\b\f \fs24 To be bold\b0\f1\fs17 \par }).

Are there any VBA routines that copy RTF text to the clipboard and then can be pasted in their formatted way? E.g. if I have "I am bold" in the RTF, it pastes as "I am bold" in a bold font.  

(NB. if there is a .NET way of doing this then that would be a second option if not VBA)

Thanks for your help.
0
Comment
Question by:gycitsupport
9 Comments
 
LVL 46

Expert Comment

by:tbsgadi
ID: 22893295
Hi gycitsupport,

Have a look at http://www.lebans.com/richtext.htm.
It also has a regular text feature

Good Luck!

Gary
0
 

Author Comment

by:gycitsupport
ID: 22893329
Hi
Thanks for that. I was really hoping to do it without a third party add-on as it really wouldn't be suitable. I can generate my rich text but it's the putting it into the clipboard that is the issue.
0
 
LVL 77

Expert Comment

by:peter57r
ID: 22893480
I don't think I understand your starting point.

Access 2000 does not have any rich text capability, so how are you storing rich text in your database unless you are already using third party tools?


0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:gycitsupport
ID: 22893546
Hi
I am using the Microsoft RichTextBox Control 6 to generate my RTF.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 22893686
Could you not use a hidden rtf control to use as your clipboard?
0
 
LVL 46

Expert Comment

by:tbsgadi
ID: 22893803
FYI with Lebans RTF you don't need to generate any code, it works just like Word.
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 22902393
So you didn't succeed with the methods for moving data via the the clipboard, Copy and PasteSpecial:

http://www.experts-exchange.com/Programming/Languages/.NET/Q_23874694.html#a22885276

/gustav
0
 

Author Comment

by:gycitsupport
ID: 22902641
Hi
I think I've managed to finally solve the problem. It involves using a clipboard_setdata routine and then find and replace using the clipboard. replacing with "^c".  I'm still trying to finalise the issue and make it work 100% of the time, but progress is being made.
0
 

Accepted Solution

by:
gycitsupport earned 0 total points
ID: 22982912
My replacement of "^c" worked for what I required. Thanks,
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

864 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