'Prepare the variable File for use
Dim File As Integer
File = FreeFile
'Prepare FileString - It will hold the contents of the required file
Dim FileString As String
'
'Set FileName to the file that you want to read from
Dim FileName As String
FileName = "c:\test\test.txt"
'
'Open the file for reading
Open FileName For Binary As #File
'Prepare the variable for holding
FileString = Space(FileLen(FileName))
'Copy the contents of the file to the prepared string, FileString
Get #File, , FileString
'Close the file
Close #File
'The string, FileString, now holds the contents of the file
'
'Put the string value into a textbox to show the contents of the file
Text1.Text = FileString
|