Excel 2007 retreive text from text file

T

Tony WONG

i posted it before and now find more info.

i wish to retrieve the whole text line into excel sheet.

but if the line start with number

"2000Office" or "2000 Office"

then, i can only retrieve "2000"

it is ok if the line start with string

how can i retrieve the whole text line even the line start number? Thanks a
lot.



****************************************************
Sub StockCount()

Range("A2").Select
Selection.End(xlDown).Select
a = Mid(ActiveCell.Address, 4)
Range("A2:b" & a).Select
Selection.ClearContents

filepath = ThisWorkbook.Path
Set objFSO = New FileSystemObject
Set objFolder = objFSO.GetFolder(filepath)
i = 1
For Each objFile In objFolder.Files
If objFile.Type = "TSV ÀÉ®×" Then
KKK = FreeFile
Open objFile For Input As KKK
Do Until EOF(KKK)
Input #KKK, ABC
If Len(ABC) > 0 And Left(ABC, 4) <> "Comp" And Left(ABC,
4) <> "Disp" And Left(ABC, 4) <> "User" And Left(ABC, 4) <> "Date" Then
i = i + 1
Cells(i, 1) = Left(objFile.Name, InStr(objFile.Name,
".") - 1)
Cells(i, 2) = ABC
End If
Loop
Close
End If
Next

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top