How do you want to Open it?
Into your own Text/RTF Box or In an External Program, like Notepad?
External Program..
Code:
Private cmdOpen_Click()
'sFileName is the Path and FileName of the Saved File you want to Open with Notepad.
Shell "Notepad.exe " & sFileName
End Sub
Into a Text/RTF Box..
Code:
Private Sub cmdOpen_Click()
Dim iFile As Integer
Dim sData As String
iFile = FreeFile
Open "TheFile.txt" For Input As iFile
sData = Input(LOF(iFile), iFile)
Close iFile
Text1 = sData
End Sub
If the File is too big for the Input() Function..
Code:
Private Sub cmdOpen_Click()
Dim iFile As Integer
Dim sData As String
Dim sChunk As String
Dim lChunk As Long
Dim lFileLen As Long
iFile = FreeFile
Open "C:\TheFile.txt" For Binary Access Read As iFile
lFileLen = LOF(iFile)
lChunk = 64000
While Loc(iFile) < lFileLen
If Loc(iFile) + lChunk > lFileLen Then lChunk = lFileLen - Loc(iFile)
sChunk = Space(lChunk)
Get #iFile, , sChunk
sData = sData & sChunk
Wend
Close iFile
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]