View Single Post
  #16   Report Post  
Posted to microsoft.public.excel.programming
Robert Crandal[_3_] Robert Crandal[_3_] is offline
external usenet poster
 
Posts: 161
Default Extract paragraphs from text file

"GS" wrote:

Function ReadTextFile$(Filename$)
' Reads large amounts of data from a text file in one single step.
Dim iNum%
On Error GoTo ErrHandler
iNum = FreeFile(): Open Filename For Input As #iNum
ReadTextFile = Space$(LOF(iNum))
ReadTextFile = Input(LOF(iNum), iNum) ' Does this line execute?

ErrHandler:
Close #iNum: If Err Then Err.Raise Err.Number, , Err.Description
End Function 'ReadTextFile()


I see that the ReadTextFile function is assigned TWO different
values.

First, it is assigned Space$(LOF(iNum))
And then is assigned Input(LOF(iNum), iNum)

I thought a function was supposed to exit once it is assigned
a value? Is it possible to assign a function a value like that?
Twice in succession??