Importing file names from Windows Explorer

gbenkler

New Member
Joined
Oct 1, 2008
Messages
2
How would I go about doing a group import of a list of file names from Windows Explorer into a column on an Excel spreadsheet?

For example, one of the folders on my PC contains a list of 22 files. If I want to make an accurate copy of the file name, I must right click it, select Rename, ctrl-C, flip over to the excel spreadsheet, enter the cell where I want the file name and ctrl-V. That is OK for one or two, but a pain soon after.

What I would love to be able to do would be to be able to run and extract macro, or some how be able to pull all of them in at once.

Any help or suggestions sincerely appreciated.
 
Last edited:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
try
Code:
Sub test()
Dim myFolder As String, fn As String, temp As String, x
With Application.FileDialog(msoFileDialogFolderPicker)
    If .Show = True Then
        myFolder = .SelectedItems(1) & "\"
    Else
        Exit Sub
    End If
End With
fn = Dir(myFolder & "*.*")
Do While fn <> ""
    temp = temp & vbLf & myFolder & fn
    fn = Dir
Loop
If Len(temp) Then
    x = Split(Mid(temp,2), vbLf)
    Range("a1").Resize(UBound(x) + 1).Value = x
Else
    MsgBox "No file"
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,454
Messages
6,178,766
Members
452,875
Latest member
Disastrouscoder

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top