-
Hi,
All I want to do is to open a file for reading using the FileSystemObject yet somehow I seem to be missing something somewhere! I keep getting the error 'Input past end of line' in the following code:
Code:
Public Sub Increase(vFileName As String)
Dim FSO As New FileSystemObject
Dim ProjectPath As String
Dim vFile As File
Dim Exists As Boolean
Dim TXT As TextStream
Dim strTemp As String
ProjectPath = FSO.BuildPath(App.Path, vFileName)
Exists = FSO.FileExists(ProjectPath)
If Exists Then
Set vFile = FSO.GetFile(ProjectPath)
Set TXT = vFile.OpenAsTextStream(ForReading)
strTemp = TXT.ReadAll '<<--Error occurs here
TXT.Close
End If
End Sub
Any help would be appreciated
cheers
Shaun
-
Hi Shaun,
I just read in MSDN that the ReadAll method can be memory hungry, I am currently (as we speak :) ) running it on an 8mb text file, it worked fine on 1/2 a meg, so I thought i'd try and kill it :D. What sort of file are you opening? and how big is it?
-
Hi,
Thanks for the reply Crispin. I can appreciate that but the file that I am trying to open contains a whole '6 LINES'.
All I am trying to do is open it to read (i will work out the writing bit later!! :) ).
And before anybody says to use GET and PUT etc.. I want to get it to work with the FSO. :rolleyes:
What am I doing wrong???????
Cheers
Shaun
-
-
Oooops
Hi Crispin,
Thanks for your help. I was just about to mail it to you when I realised that the text file actually contained no text!!! :rolleyes:
It must have got deleted when I was messing about with the 'ForReading','ForWriting' parameter!
Must be time to go home!!!!!!!!!!!!!!!
Cheers
Shaun