View Single Post
  #6  
Old 01-05-2005, 09:06 PM
Don Wiss
Guest
 
Posts: n/a
Re: Getting text file into a VBA string variable

On Thu, 6 Jan 2005, Robin Hammond <rjNOrhSPAM@PLEASEnetvigator.com> wrote:

>You need something like this for binary access
>
>Sub ReadFile()
>Dim hFile As Long
>Dim strFile As String
>Dim strData As String * 4
>
>hFile = FreeFile
>strFile = "C:\Something.txt"
>Open strFile For Binary Access Read As hFile Len = 4
>Get hFile, 1, strData
>Close hFile
>MsgBox strData
>End Sub


How would I expand this to read in a file of unknown length?

>or you could look at ReadLine in the filesytstemobject library


Okay. But this stops at the first newline character. I'd like to read those
characters in also, just as the file exists on the disk.

Don <donwiss at panix.com>.
Reply With Quote