O
Omar
Hi everyone,
I have a sub that searches for files in a directory and adds them to the
list box. I want the user to be able to click on a filename inside the
listbox and open it (pdf file). Can someone give me some suggestions on how
to do this? thanks for your help. here is what i got:
Dim fs As Object
Dim I As Integer
'Dim Flange_sname(100) As String
'
Set fs = Application.FileSearch
With fs
.LookIn = "X:\Omar\Finished_Flanges"
.SearchSubFolders = False
.Filename = Flange_sname
.FileType = ".pdf"
If .Execute() > 0 Then
'MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For I = 1 To .FoundFiles.Count
'MsgBox .FoundFiles(I)
Lbx_file_names.AddItem .FoundFiles(I)
Next I
Else
'MsgBox "There were no files found."
End If
End With
this returns = X:\Omar\Finished_Flanges\14_600_RTJ_WN_S40.pdf
I have a sub that searches for files in a directory and adds them to the
list box. I want the user to be able to click on a filename inside the
listbox and open it (pdf file). Can someone give me some suggestions on how
to do this? thanks for your help. here is what i got:
Dim fs As Object
Dim I As Integer
'Dim Flange_sname(100) As String
'
Set fs = Application.FileSearch
With fs
.LookIn = "X:\Omar\Finished_Flanges"
.SearchSubFolders = False
.Filename = Flange_sname
.FileType = ".pdf"
If .Execute() > 0 Then
'MsgBox "There were " & .FoundFiles.Count & " file(s) found."
For I = 1 To .FoundFiles.Count
'MsgBox .FoundFiles(I)
Lbx_file_names.AddItem .FoundFiles(I)
Next I
Else
'MsgBox "There were no files found."
End If
End With
this returns = X:\Omar\Finished_Flanges\14_600_RTJ_WN_S40.pdf