Saturday, December 12, 2009

Read Text From a File

Here's how to read text from a file. First create a new module and paste the following code:

Public Function TextFromFile(fInStream As String) As String
Dim i As Long, strText As String
i = FreeFile
strText = ""
Open fInStream For Input Lock Write As #i
Screen.MousePointer = vbHourglass
DoEvents
strText = StrConv(InputB$(LOF(i), i), vbUnicode)
Close #i
Screen.MousePointer = vbDefault
TextFromFile = strText
End Function


No comments:

Post a Comment