View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
George Lee George Lee is offline
external usenet poster
 
Posts: 9
Default Paste RTF Into A Cell

In VBA I'm trying to paste from a rich text control (RichTx32.ocx) to a
worksheet (Excel 2007) cell but the text always comes out as the unformatted
RTF. How do I paste it so that it appears a properly formatted text?

The code:
Sub RFTTest()
Dim richTextString As String
richTextString = UserForm1.RichTextBox1.TextRTF

Dim myDataObject As New dataObject
Set myDataObject = New dataObject

myDataObject.SetText richTextString ', &HBF01 '(This flag doesn't work
either)
myDataObject.PutInClipboard

Worksheets("Sheet1").Range("D3").Select
Selection.PasteSpecial
End Sub