nschulz777
asked on
Treat Consecutive Delimiters as One
I'm using the following code to import a space
delimited file. Works fine if there is only
one space. How can I import files with a varied
number of spaces?
Line Input #s1, strField
ary1 = Split(strField, " ")
outFields = UBound(ary1)
str1 = ary1(0)
str2 = ary1(1)
str3 = ary1(2)
delimited file. Works fine if there is only
one space. How can I import files with a varied
number of spaces?
Line Input #s1, strField
ary1 = Split(strField, " ")
outFields = UBound(ary1)
str1 = ary1(0)
str2 = ary1(1)
str3 = ary1(2)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Took me awhile to have time to try your code,
works perfectly,
Thanks
works perfectly,
Thanks
Line Input #s1, strField
Set m_RegExp = New VBScript_RegExp_55.RegExp
With m_RegExp
.Pattern = " +" 'Look for more than one blank
.Global = True
strField = .Replace(strField, " ")
End With
Set m_RegExp = Nothing
ary1 = Split(strField, " ")
outFields = UBound(ary1)
str1 = ary1(0)
str2 = ary1(1)
str3 = ary1(2)
Anthony