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?
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?