What I have:
Used a code and copied the filenames of the files from a particular folder onto an excel sheet
Code used :
Private Sub GetFileNames_click()
Dim xRow As Long
Dim xDirect$, xFname$, InitialFoldr$
InitialFoldr$ = "G:\" '<<< Startup folder to begin searching from
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$ <> ""
Dim val2 As String
val2 = ComboBox1.RowSource
If val2 = ("Couplings") Then
ActiveWorkbook.Worksheets("Falk gear Box").Activate
Range("B4").Select
' Worksheets("Falk gear Box").Range("C4").Select = ActiveCell
ActiveCell.Offset(xRow) = xFname$
xRow = xRow + 1
xFname$ = Dir
End If
Loop
End If
End With
End Sub
Courtesy : above code is a modified version of a code got from the net.
What I need :
The above code only copies the file names onto column 2. I wanted help in finding a way as to how to display the file path from where the above file names were taken ?
Any help is much appreciated...
Thanks in advance
Bookmarks