I need to "scrub" text entered into a text box. By "scrub" I mean that I want to remove certain unwanted
characters and formatting. My code (below) effectively removes all unwanted characters, but certain carriage returns, etc.,
are not removed. Any suggestions?
To test the code, I go to the following website:
http://shakespeare.about.com/library.../aa011801a.htm, press cntrl-A to select all text, copy, and then paste from clipboard
into a textbox in a userform. This is first few lines of the output:
" You are here:About>Homework
Help>ShakespeareHomework HelpShakespeareEssentialsShakespeare FAQsQuotationsSoliloquy AnalysisElizabethan Glossary
Shakespeare TimelineShakespeare OffersShakespeare Plays Shakespeare Movie BBC Shakespeare Shakespeare Videos William
Shakespeare What are offers?Articles & ResourcesStudent "
Note that the there is a hard-return after
"Homework" on the first line. I need to remove this. The text needs to end up as one large paragraph with no
carriage returns, paragraphs breaks, etc....
The code (userform, textbox1,commandbutton1)
Private Sub CommandButton1_Click()
Dim original_text, Revised_text, chk_char, firsts_string As String
Dim Character_count As Integer
original_text = TextBox1.Value
Character_count = Len(original_text)
For i = 1 To Character_count
chk_char = Asc(Mid(original_text, i, 1))
If chk_char > 31 And chk_char < 126 Then
Revised_text = Revised_text & Mid(original_text, i, 1)
TextBox1.Value = Revised_text