how can i make a VBA code so that it prints all the filname og the files, when they are placed in many different folders.
The folder i looking like this:
for now my code looks like this, but i will only print the filename, if all the files are ind the same folder:
I i want i to print:
The folder i looking like this:
- Name1
- (...)
- Name2
- LV Faste
- A.xlsx
- B.xlsx
- ...
- LV Lose
- C.xlsx
- D.xlsx
- ...
- LH Faste
- E.xlsx
- F.xlsx
- ...
- LH Lose
- G.xlsx
- LV Faste
VBA Code:
Option Explicit
Sub GetSheet()
Dim sFilename as String
Dim sPath as String
sPath = "C:\Users\silas\Desktop\Time\"
sFilename = Dir(sPath & "*.xlsx")
Do While Len(sFilename) > 0
Debug.Print sFilename
sFilename = Dir()
Loop
End Sub
I i want i to print:
- A.xlsx
- B.xlsx
- C.xlsx
- D.xlsx
- E.xlsx
- F.xlsx
- G.xlsx