Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Lebans Rich Text Control

Discussion in 'Information Technology' started by Jesse, Jul 28, 2006.

  1. Jesse

    Jesse
    Expand Collapse
    Guest

    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?
     
  2. Loading...

    Similar Threads Forum Date
    The Rags-To-Riches Tale Of How Jan Koum Built WhatsApp Into Facebook's New $19 Billion Baby Inspirational Stories Feb 21, 2014
    Opinion Rich People Just Care Less Breaking News Oct 19, 2013
    India Sikhs richest and muslims poorest among religious groups Breaking News Aug 21, 2013
    S Asia Holy cremations boom in richer India Breaking News Nov 13, 2011
    Abandoned by Rich Sons, Old Lady is Rescued from the Street Hard Talk Nov 10, 2011

  3. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

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

    HTH

    Pieter

    "Jesse" <monk@coqui.net> wrote in message
    news:1147253260.919529.233370@g10g2000cwb.googlegroups.com...
    >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?
    >
     
  4. Jesse

    Jesse
    Expand Collapse
    Guest

    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.
     

Share This Page