formerTexan
Programmer
I have been saving up some related questions regarding RichTextBoxes (RTB), so here goes:
1. It looks like RTB's no longer come as an ActiveX add in in A2003. Have they been replaced with something new and improved? Or am I missing something somewhere.
2. Peculiar behavior: I have a form with an RTB control and native Access textbox, both bound to the same memo field. The field contains some copy/pasted email text. As soon as I add the RTB control to the form, all of the html/xml tags from the original email text become visible in the native textbox control. Very yucky. I hadn't even realized the they had come along into the database. Has anyone else run into this oddity and have any guesses as to the reasons why.
3. RTB's allow portions of text strings to be selectively colored (highlighted). Very nice and saves a lot of API coding. However I would find it useful to be able to remove the highlights based on color. For example: change all red text to black text. The following bit of code will do this, but gets slow as it loops through the entire text string making a character by character comparision. This becomes excruciatingly slow by the time the text string hits about 15,000 characters. I haven't tweaked the code and I can probably think of something to gain a little performance, but does anyone have any ideas for a radical improvement. API?
Dim objRTB As Object 'RichTextBox
Dim lngLen As Long
Dim lng As Long
Set objRTB = Me.xtxtItem
lngLen = Len(objRTB.Text)
DoCmd.Echo False
With objRTB
For lng = 1 To lngLen
.SelLength = 1
If .SelColor = 255 Then
.SelColor = Not 255
.SelBold = False
End If
Next lng
.SelStart = 1
End With
DoCmd.Echo True
Set objRTB = Nothing
Thanks much.
Bill
1. It looks like RTB's no longer come as an ActiveX add in in A2003. Have they been replaced with something new and improved? Or am I missing something somewhere.
2. Peculiar behavior: I have a form with an RTB control and native Access textbox, both bound to the same memo field. The field contains some copy/pasted email text. As soon as I add the RTB control to the form, all of the html/xml tags from the original email text become visible in the native textbox control. Very yucky. I hadn't even realized the they had come along into the database. Has anyone else run into this oddity and have any guesses as to the reasons why.
3. RTB's allow portions of text strings to be selectively colored (highlighted). Very nice and saves a lot of API coding. However I would find it useful to be able to remove the highlights based on color. For example: change all red text to black text. The following bit of code will do this, but gets slow as it loops through the entire text string making a character by character comparision. This becomes excruciatingly slow by the time the text string hits about 15,000 characters. I haven't tweaked the code and I can probably think of something to gain a little performance, but does anyone have any ideas for a radical improvement. API?
Dim objRTB As Object 'RichTextBox
Dim lngLen As Long
Dim lng As Long
Set objRTB = Me.xtxtItem
lngLen = Len(objRTB.Text)
DoCmd.Echo False
With objRTB
For lng = 1 To lngLen
.SelLength = 1
If .SelColor = 255 Then
.SelColor = Not 255
.SelBold = False
End If
Next lng
.SelStart = 1
End With
DoCmd.Echo True
Set objRTB = Nothing
Thanks much.
Bill