Hi Guy's hope everyone is staying safe and well
The below code i have got adds folder names listing to another list box when i click (Listing folders only)
Can this be adapted to add folder names and file names within the selected directory ? (wanting to list folders and files)
Additional to this, is there a method of opening the file if it is a file you have clicked on or not opening if it is another directory ???
ie: if extensions = "" then it's a folder or If extensions <> "" then Application.FollowHyperlink ?????
Code:
Dim fso As Object Dim sf2 As Variant, fl2 As Variant
Dim i As Integer
Me.lstDir2.RowSource = "Value List"
Me.lstDir2.RowSource = ""
Set fso = CreateObject("Scripting.FileSystemObject")
Set fl2 = fso.GetFolder("T:\" & lstDir1 & "\")
Set sf2 = fl2.SubFolders
For Each fl2 In sf2
i = i + 1
Me.lstDir2.AddItem fl2.Name
Next
Me.lstDir2.Requery