Hi
I have macro wich list files in the certain folder and I want to change it to not have to select the folder all. Files wich I want to list are in the directory:
D:\faktury
Code
- Option Explicit
- Sub GetFileNames()
- Dim xRow As Long
- Dim xDirect$, xFname$, InitialFoldr$
- InitialFoldr$ = "D:"
- With Application.FileDialog(msoFileDialogFolderPicker)
- .InitialFileName = Application.DefaultFilePath & ""
- .Title = "Please select a folder to list Files from"
- .InitialFileName = InitialFoldr$
- .Show
- If .SelectedItems.Count <> 0 Then
- xDirect$ = .SelectedItems(1) & ""
- xFname$ = Dir(xDirect$, 7)
- Do While xFname$ <> ""
- ActiveCell.Offset(xRow) = xFname$
- xRow = xRow + 1
- xFname$ = Dir
- Loop
- End If
- End With
- End Sub