Try this
Option Explicit
Private Sub Command1_Click()
Dim intCount As Integer
Dim strTemp As String
Dim xx As Long
Dim a As Integer
Dim b As Integer
'
'create the string with all ascii characters
strTemp = "There shouldn't be more than
one space between these words"
For xx = 0 To 255
strTemp = strTemp & Chr(xx)
Next xx
'
Print strTemp
'
For intCount = 1 To 6
'below-zero ascii characters
'chr(32) is the SPACE character
'chr(39) is apostrophe
'
If intCount = 1 Then
a = 0
b = 31
End If
If intCount = 2 Then
a = 33
b = 38
End If
If intCount = 3 Then
a = 40
b = 47
End If
If intCount = 4 Then
a = 58
b = 64
End If
If intCount = 5 Then
a = 91
b = 96
End If
If intCount = 6 Then
a = 123
b = 255
End If
For xx = a To b
strTemp = Replace(strTemp, Chr(xx), "")
Next xx
Print strTemp
Next intCount
'
Print
Print strTemp
'remove double spaces
'this is a brute force solution
For xx = 1 To 1000
strTemp = Replace(strTemp, " ", " ")
Next xx
Print
Print strTemp
End Sub
> I'm trying to copy some information from an ASCII text file and then paste
it into a Rich Text Box bound to an Access data field. The ASCII text often
contains a lot of special characters and extraneous spaces, both at the
start of each line and at the end. I would like to strip out everything
except for the standard text characters and the necessary spaces between
words. I know I'll have to process each line separately and check each
character individually, at least on the left hand side of each line. I thoug
ht I had seen a simple program to read only standard ASCII characters into a
text box, but I can't find it now. I would appreciate any help or
suggestions you might have.
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~->
'// =======================================================
Rules : http://ReliableAnswers.com/List/Rules.asp
Home : http://groups.yahoo.com/group/vbHelp/
=======================================================
Post : [EMAIL PROTECTED]
Join : [EMAIL PROTECTED]
Leave : [EMAIL PROTECTED]
'// =======================================================
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/vbhelp/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/