Home > Archive > Visual Basic > September 2004 > Clipboard RTF Format - Pasting RTF to PowerPoint
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Clipboard RTF Format - Pasting RTF to PowerPoint
|
|
| Brian H. 2004-09-28, 3:55 pm |
| OK, this problem seems like it should be easy to solve, but the solution
continues to evade me. I need to put some rtf formatted text into both Word
documents and PowerPoint presentations. Word is not an issue, I just use the
following code:
Clipboard.Clear
Clipboard.SetText uscModAssump_Description.TextRTF, vbCFRTF
objWord.Selection.PasteAndFormat wdFormatOriginalFormatting
where uscModAssump_Description is an custom ActiveX control that contains an
RTF box.
PowerPoint presents an issue though. I can manually copy text from an RTF
box and paste it into the PowerPoint slide, but when I try to do it
programmatically, PowerPoint doesn't recognize the RTF format stored in the
Clipboard. I have tried various things to try and work around this issue,
but have not had success. The following code should work, but does not.
Clipboard.Clear
Clipboard.SetText frmMain.rtfExport.TextRTF, vbCFRTF
oPPT.ActiveWindow.Selection.TextRange.PasteSpecial ppPasteRTF
Any help on this issue would be greatly appreciated.
Brian H.
| |
| Brian H. 2004-09-28, 3:55 pm |
| Since posting I have found a working solution, it's not elegant, but it
works. I place an RTF box on my form, load the text into it, and select the
text. Then I use SendKey "^C",True to simulate manual copying and finish
with oPPT.ActiveWindow.Selection.TextRange.PasteSpecial ppPasteRTF
If anyone has a better solution, I would be thankful still.
Brian H.
"Brian H." wrote:
> OK, this problem seems like it should be easy to solve, but the solution
> continues to evade me. I need to put some rtf formatted text into both Word
> documents and PowerPoint presentations. Word is not an issue, I just use the
> following code:
>
> Clipboard.Clear
> Clipboard.SetText uscModAssump_Description.TextRTF, vbCFRTF
> objWord.Selection.PasteAndFormat wdFormatOriginalFormatting
>
> where uscModAssump_Description is an custom ActiveX control that contains an
> RTF box.
>
> PowerPoint presents an issue though. I can manually copy text from an RTF
> box and paste it into the PowerPoint slide, but when I try to do it
> programmatically, PowerPoint doesn't recognize the RTF format stored in the
> Clipboard. I have tried various things to try and work around this issue,
> but have not had success. The following code should work, but does not.
>
> Clipboard.Clear
> Clipboard.SetText frmMain.rtfExport.TextRTF, vbCFRTF
> oPPT.ActiveWindow.Selection.TextRange.PasteSpecial ppPasteRTF
>
> Any help on this issue would be greatly appreciated.
>
> Brian H.
|
|
|
|
|