VB6 RtfTextBox / excel Question

dave_p

n00b
Joined
Apr 4, 2006
Messages
12
I have an access database with a few fields that are rtf formatted text, i need to strip out the formatting and then load the tables into an oracle database. i exported the table to a .csv, and then wrote a few modules in vba to remove crlf's and such. i then wrote this procedure to strip out the rtf formatting:

Code:
Sub convert()

Dim pobjCell As Range
Dim plCharCounter As Long
Dim richtextbox1 As New RichTextBox
Dim psCellText As String

For Each pobjCell In Selection
psCellText = pobjCell.Text

richtextbox1.TextRTF = psCellText

pobjCell.Value = richtextbox1.Text
Next

End Sub

i keep getting an error runtime error 387, set not permitted

when i hover over the error, the tooltip from the code states:
get not supported (write-only property)

from all i have read, this was one of the more suggested methods of doing this. what am i missing?
 
Code:
Sub convert()

Dim pobjCell As Range
Dim plCharCounter As Long
Dim psCellText As String

For Each pobjCell In Selection
psCellText = pobjCell.Text
ActiveSheet.rtb.TextRTF = psCellText
pobjCell.Value = ActiveSheet.rtb.Text
Next

End Sub
what i did in this case to make it work was to just drag a richtextbox out onto the .csv file and then reference it in the macro.

if i wanted to do it in code, i would have to create a user form and then the rtbox and reference it from the form. for some reason it wouldnt just let me create the box in the macro.
 
Back
Top