Sub readFile()
'Excel macro to read a text file
Dim myfso As Scripting.FileSystemObject
Dim stream As Scripting.TextStream
Set myfso = New Scripting.FileSystemObject
'open text file in read mode.
Set stream = myfso.OpenTextFile("c:\tempfile.txt", ForReading, True)
MsgBox stream.ReadAll
End Sub
What do you think on above excel macro topic? Please provide your input, comments, questions on excel macro. I will try to reply as soon as possible. I value your opinion on Excel Macros.
'Excel macro to read a text file
Dim myfso As Scripting.FileSystemObject
Dim stream As Scripting.TextStream
Set myfso = New Scripting.FileSystemObject
'open text file in read mode.
Set stream = myfso.OpenTextFile("c:\tempfile.txt", ForReading, True)
MsgBox stream.ReadAll
End Sub
What do you think on above excel macro topic? Please provide your input, comments, questions on excel macro. I will try to reply as soon as possible. I value your opinion on Excel Macros.
why not:
ReplyDeleteDim fline As String
Dim inName As String
Dim inFile As Integer
...
inFile = FreeFile
Open inName For Input As #inFile
Do While Not EOF(inFile)
Line Input #inFile, fline
fline = RTrim(fline)
...
Loop
Close #inFile