View Single Post
  #5   Report Post  
Dave Peterson
 
Posts: n/a
Default

I pasted your sample data into a text file and saved it.

I got this out:

Property Address Total Value FileName
**Error** **Error** c:\my documents\excel\README.TXT
205 MAIN ST 8100 c:\my documents\excel\Edit3.txt
**Error** **Error** c:\my documents\excel\test.txt
**Error** **Error** c:\my documents\excel\spacedelim.txt


Just guesses.

You did change the folder name:
myPath = "c:\my documents\excel"

Do you have any lines with leading spaces?

If yes, you could clean them up in your favorite text editor (yech!) or just do
it in code:

Do While Not EOF(FileNum)
Line Input #FileNum, myLine
If LCase(Left(Trim(myLine), Len(Str1))) = Str1 Then '<---
wks.Cells(oRow, "A").Value = Trim(Mid(myLine, Len(Str1) + 1))
FoundAddr = True
ElseIf LCase(Left(Trim(myLine), Len(Str2))) = Str2 Then '<---
wks.Cells(oRow, "B").Value = Trim(Mid(myLine, Len(Str2) + 1))
FoundTot = True
Exit Do 'no need to contine reading the file
End If
Loop

(notice the addition of Trim() in 2 spots.)

(I'm guessing that there's something else in that text file that's difficult to
see/notice.)




Willie T wrote:

Dave,

Thanks a million. It is a colon, my bad. Your code makes more sence
and runs fine, but I'm returning **Error** in both cases. Again, I new
to VBA and programming but i can step thru your code, see how it work,
and follow it fairly well. Below is a sample of one of the text files
that I running your code against. It the 14th line down for Str1 and
the 34th line down for Str2. Can you help? Thanks again for your help
in advance.

Report on Parcel xx-xx-2-000-022.000 00Courthouse Retrieval System -
Jefferson
County, AL
Report on Parcel :xx-xx-2-000-022.000 00Generated :1/4/2005

General Information

LastName FirstName MidNane
FirstName MidNane
xxxx CHERRY AVE
BIRMINGHAM , AL 35214Parcel ID:xx-xx-2-000-022.000 00
Alt-Parcel ID:152420002200
Subdivision
Property Address:205 MAIN ST
BIRMINGHAM, AL 35213-2914
Telephone:()-
Special Int:
Map Sort::
Plat Book:0000
Subdv Block:
Parcel:0
SSD1:000
Ward:05
Land C Map:
Acct No:
Page:0000
Lot:
District:05
SSD2:

Land Value:2900
Improvement Value:5200
Total Value:8100
Assessed Value:1620


--

Dave Peterson