How to use Open statement to open file selected from drivelist and filelist? Pls help!!!
Posted on 2003-02-26
Hi..I try to use the Open statement to open a file that is selected from the drive,dir and file list.However I get an error "File not found" but in actual fact the file does exist.This is what I do:
Private Sub FileERT_Click()
Dim i%, textline$, k1$, a1$, d1$
d1 = DirERT.Path & " \ " & FileERT.FileName
i = FreeFile
Open "d1" For Input Shared As #i <--error occurs here
Do While Not EOF(i)
Line Input #i, textline 'reading each line
k1 = Mid(textline, 2, 2)
a1 = Right(textline, 2)
If i were to replace the line where error occurs with this:
Open "D:\sample_ERT\HC05C8A.txt" For Input Shared As #i
then it is ok. Directory is the same as d1.