Hello,
I need to strip out the RTF code in a text box and place the resulting plain text in to another text box.
I have two approaches that might work. The first is to use a regular expression to take out the RTF. The second is to use Ole Automation to paste the text into Notepad, and then copy the plain text from notepad into another field.
Can anyone suggest a regular expression that will remove rich text code and/or show me the code to manipulate the notepad object?
I've started with this code:
I need to strip out the RTF code in a text box and place the resulting plain text in to another text box.
I have two approaches that might work. The first is to use a regular expression to take out the RTF. The second is to use Ole Automation to paste the text into Notepad, and then copy the plain text from notepad into another field.
Can anyone suggest a regular expression that will remove rich text code and/or show me the code to manipulate the notepad object?
I've started with this code:
Code:
'Copy contents of hidden textbox
With Me!txtcusRTF
.Visible = True
.SetFocus
.SelStart = 0
.SelLength = Len(Me!txtcusRTF.Text)
End With
RunCommand acCmdCopy
Me!txtcusRTF.Visible = False
'Here is where I want to strip out RTF or paste into Notepad, and then paste into a different text box.
Exit Sub
err_copystrip:
ErrBox "stripping out RTF and pasting into table for searching in cmdCopyStrip_click"
End Sub