Cannot paste to Excel
Posted on 2013-10-01
I have a Visual Basic 2008 application which copies a RTF stream to the clipboard. I am trying to paste this into Excel programmatically. But it is not working.
When the code executes nothing is placed in Excel. The information is successfully copied into the Clipboard. I know this because I can paste the RTF document manually into Word with Ctrl-V. Oddly, the PASTE option is not available in Excel when the RTF document is programmatically copied into the clipboard.
However, if I copy the RTF document from Word with Ctrl_C and then go to Excel, Paste is available.
Summary Paste into Word Paste into Excel
Programmatic Copy Y N
Manual Copy from Word Y N
I have included the code (4 line) in the attached Word document. Also in the Word document is the Rtf document I am trying to copy and paste. Notice the Greek and subscript characters.
The variable sExportString represents the RTF document converted into a String. This is in the Word document also.
I am puzzled. Thank you for your assistance.