troubleshooting Question

RTF Memo - make font size consistent

Avatar of terpsichore
terpsichore asked on
Web Languages and StandardsMicrosoft AccessHTML
5 Comments1 Solution545 ViewsLast Modified:
Users continually paste text into various RTF memo fields - this works well, except they are now a hodgepodge of font sizes, some of them very large and hard to read.
I found the code below - which seemed to work, but doesn't really. It works the first time, but then when you, for example, change some local formatting (e.g., add some italic to a phrase), it seems to nuke the memo field altogether -
any ideas are appreciated:

CALLING THE FUNCTION:

Me.txtProjectNotes_Production.value = nukefontsize_in_rtf(Me.txtProjectNotes_Production.Value)

Function nukefontsize_in_rtf(strtext As String) As String


   
    Dim lngTagStart As Long
    Dim lngTagEnd As Long
    Dim blnReset As Boolean

   
    Do
        lngTagStart = InStr(strtext, "<font")
        If lngTagStart > 0 Then
            lngTagEnd = InStr(lngTagStart, strtext, ">")
            strtext = left$(strtext, lngTagStart - 1) & Mid$(strtext, lngTagEnd + 1)
            blnReset = True
        End If
    Loop Until lngTagStart = 0

    If blnReset Then
        strtext = Replace(strtext, "</font>", vbNullString)
        nukefontsize_in_rtf = strtext
    End If
End Function
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros