File Directory info into Excel

0

When I use Windows File Directory, I can see the listings of a directory or sub directory showing such data as file name, file type and other file information.  How can I input that information into an Excel spreadsheet?

Answer
Discuss

Discussion

Honestly, I have no idea what you mean... edit your question and provide a more thorough explanation.
don (rep: 1492) Jan 10, '17 at 12:12 pm
Add to Discussion

Answers

0

Well here is a macro that you can use to navigate to a specific directory and then select it and list all files within it including their extensions.

Option Explicit
Sub GetFileNames()
Dim xRow As Long
Dim xDirect, xFname
Dim Dest As Range

'Change this to put the data in a different place in the workbook.
Set Dest = ActiveCell

With Application.FileDialog(msoFileDialogFolderPicker)
.InitialFileName = Application.DefaultFilePath & "\"
.Title = "Select a folder"
.Show
    If .SelectedItems.Count <> 0 Then
        xDirect = .SelectedItems(1) & "\"
        xFname = Dir(xDirect, 7)
        Do While xFname <> ""
            Dest.Offset(xRow) = xFname
            xRow = xRow + 1
            xFname = Dir
        Loop
    End If
End With

End Sub
Discuss

Answer the Question

You must create an account to use the forum. Create an Account or Login