Open a File

  • Thread starter Thread starter gr
  • Start date Start date
G

gr

Hi all,

I have a Listbox which displays all the files in a Folder.
I want to let the user select a file from the list and
after clicking a command button open the selected file.

I found some help in MS Access but not working.. my code
is:

Private Sub cmdOpenSavedReports_Click()
Dim lst As ListBox
Dim strFile As String
Dim fs, f
Set lst = Me.LstReports
strFile = "I:\Access Dbases\Service\Reports\"
strFile = strFile & lst.Value
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(strFile)
f.Close
End Sub

No error is displayed, but no file is opened..
any ideas?
thx.
 
Back
Top