Lebans Rich Text Control

J

Jesse

I have a form that serves to collect general notes. The text control
is attached to the memo field, as required. I want to display a list
of the notes so the user can select which one to further edit, view or
print. The list shows several items including information from the
memo field (the first 30 characters). The problem lies in the fact
that those first characters are part of the RTF and are not the text
that I want to show. I have tried to create a function that provides
only the text.

Public Function GetNotesText(varText As Variant) As Variant
' Comments : Function to remove RTF formatting and return plain
text
' Parameters: varText - RTF string to evaluate
' Returns : Variant - string that contains just the plain text
from varText or Null
' Created : 08 May 2006 05:42 JA
' Modified :
' --------------------------------------------------

On Error GoTo ErrorHandler
Dim rtf As RTF2
Set rtf = New RTF2

rtf.RTFtext = varText
GetNotesText = rtf.PlainText

Debug.Print rtf.PlainText
Set rtf = Nothing

ExitHandler:
Exit Function

ErrorHandler:
MsgBox _
Prompt:="Error " & Err.Number & vbNewLine & Err.Description &
vbNewLine & "In FillNotesList."
Resume ExitHandler
End Function

This function, and others similar to it, doesn't work. It appears that
without a "physical" reprepsentation (the OCX control in a form or
report), no text can be assigned or manipulated. Is there a way to
work around this?
 
P

Pieter Wijnen

You probably have to use a form as you've discovered
This form you can open "hidden" & do your stuff

HTH

Pieter
 
J

Jesse

I don't think that will work. This function is intended to be used
from a query to present a list and if I have to open a hidden form and
assign it the RTF text so I can extract it and then send the extracted
text to the query, it might prove to slow.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top