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

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.
gycitsupportAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tbsgadiCommented:
Hi gycitsupport,

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

Good Luck!

Gary
0
gycitsupportAuthor Commented:
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
peter57rCommented:
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
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

gycitsupportAuthor Commented:
Hi
I am using the Microsoft RichTextBox Control 6 to generate my RTF.
0
rockiroadsCommented:
Could you not use a hidden rtf control to use as your clipboard?
0
tbsgadiCommented:
FYI with Lebans RTF you don't need to generate any code, it works just like Word.
0
Gustav BrockCIOCommented:
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
gycitsupportAuthor Commented:
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
gycitsupportAuthor Commented:
My replacement of "^c" worked for what I required. Thanks,
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.