Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Strip out RTF code? (A97/2000)

    Many moons ago I decided to write a Code Library for all the code I re-use quite frequently. I had it finished and was using it and it worked quite well.

    Well, at work we switched from Win95 to Win2K and it stopped working and I was unable to get it to work again, mostly because of 3rd party controls not loading and I gave up.

    Recently I revisited it and found the .mdb that was used as the database to hold the code. Some (most) of the code contains Rich Text codes.

    Is it possible to strip out that Rich Text code?

    Thanks! I'd hate to lose all this great code....
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Strip out RTF code? (A97/2000)

    Do you mean that the VBA code contains RTF tags? That is very strange. Could you attach a small sample?

  3. #3
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Strip out RTF code? (A97/2000)

    No, the table has a field where the contents contain RTF.

    The table is named "codeitems"
    The field is named "Code" and is a Memo field.

    Here is one example of what is in one of the fields:
    <pre>{rtf1ansiansicpg1252deff0deftab720{fonttbl{f0 fswiss MS Sans Serif;}{f1froman
    fcharset2 Symbol;}{f2fmodern Courier New;}{f3fmodern Courier New;}}
    {colortblred0green0blue0;red0green127blue0;red0gre en0blue127;}
    deflang1033pardplainf2fs20cf2 Functionplainf2fs20cf0 FDay(NumMon plainf2
    fs20cf2 Asplainf2fs20cf0 plainf2fs20cf2 Integerplainf2fs20cf0 ) plainf2
    fs20cf2 Asplainf2fs20cf0 Date
    par plainf2fs20cf1 '*******************************************plainf 2fs20cf0
    par plainf2fs20cf1 'Name: FDay (Function)plainf2fs20cf0
    par plainf2fs20cf1 'Purpose: Determines the first of any month nummonplainf2fs20cf0
    par plainf2fs20cf1 ' months prior or following the current monthplainf2fs20cf0
    par plainf2fs20cf1 'Input1: ? FDay(2) = #2/01/2001#plainf2fs20cf0
    par plainf2fs20cf1 'Input2: ? FDay(-2) = #10/1/00#plainf2fs20cf0
    par plainf2fs20cf1 '*******************************************plainf 2fs20cf0
    par
    par plainf2fs20cf1 'determines the first day of any month nummonplainf2fs20cf0
    par plainf2fs20cf1 'months prior or following the current monthplainf2fs20cf0
    par Tab plainf2fs20cf2 Dimplainf2fs20cf0 NewDate plainf2fs20cf2
    Asplainf2fs20cf0 Date
    par
    par Tab NewDate = DateSerial(Year(Date), Month(Date) + NumMon, 1)
    par Tab FDay = NewDate
    par plainf2fs20cf2 Endplainf2fs20cf0 plainf2fs20cf2 Functionplainf2fs20cf0
    par }</pre>

    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Strip out RTF code? (A97/2000)

    Add a second memo field to the table, say PlainCode.
    Create a form based on the table.
    Add a Microsoft Rich TextBox control to the form.
    Name it (for example) ctlRTF.
    Set its Control Source to Code (the name of the memo field with RTF data).
    Put a command button on the form, say cmdConvert.
    Create the following On Click event procedure:

    Private Sub cmdConvert_Click()
    On Error GoTo ExitHandler
    RunCommand acCmdRecordsGoToFirst
    Do Until Me.NewRecord
    Me.PlainCode = Me.ctlRTF.Text
    RunCommand acCmdRecordsGoToNext
    Loop
    ExitHandler:
    End Sub

    This will fill the PlainCode field with the stripped code.

  5. #5
    3 Star Lounger
    Join Date
    Sep 2001
    Location
    Stuck at work..., Missouri, USA
    Posts
    248
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Strip out RTF code? (A97/2000)

    That worked perfectly, Hans.

    Thank you for the pointer to the Rich Text Box. Been a long time since I've used them.
    <font face="Comic Sans MS">Morgan Erickson</font face=comic>
    morgan.erickson@sprint.com
    <img src=/S/flags/USA.gif border=0 alt=USA width=30 height=18>-From <img src=/S/flags/Colorado.gif border=0 alt=Colorado width=30 height=18> but living in <img src=/S/flags/Missouri.gif border=0 alt=Missouri width=30 height=18>...and working in Kansas.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •