Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RichTextBox: Using CreateObject In Module, or Convert RTF to Text

Status
Not open for further replies.

SleepDepD

Programmer
Mar 13, 2004
65
US
Having a problem, maybe someone can help: I have a DataReport in my project that prints from multiple places so I have a global procedure to handle printing. One of the fields it gets from my DB is RTF text; I need a way to convert this RTF to plain text before putting it into the RPT (I'm putting it into a LBL, not a bound TXT).

To convert the RTF, I've tried using:
Code:
Set objRTF = CreateObject("RichTextLib.RichTextBox")
in the global procedure, but that didn't work; like the class isn't named that or something. Does any know why it might not be? Or another way to easily convert RTF to plain text?

Thanks a lot.
 
uhmmm...that didn't work. The "RichTextLib" library doesn't have a "RichTextCtrl" class in it.
 
No. But then I didn't advise you to use the RichTextLib library...
 
Oops...I suppose that's what I get for not carefully reading your post (..."RichText", not "RichTextLib"--doh!)

Well, this is what I tried:
Code:
Public Function ConvertRTFToText(strRTF As String) As String
'===============================================================================
  Dim obj                 As Object
  
  Set obj = CreateObject("RichText.RichTextCtrl")
  With obj
    .SelRTF = strRTF
    ConvertRTFToText = .Text
  End With
End Function
And that still didn't work. What I'm going to do is just go ahead and use an FRM with an invisible RTF on it--not the best way to do it, but it'll work.

Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top