Hello everybody (hello doctor nick)
I'm a long time reader and follower first time posting.
From this amazing community i was able to import multipul file names into excel. One down side was that sometimes i only need to select one file instead of the whole folder. I used the following code but it does not work.
Dim xFso As Object
Dim xFolder As Object
Dim xFile As Object
Dim xFiDialog As FileDialog
Dim xPath As String
Dim i As Integer
Set xFiDialog = Application.FileDialog(msoFileDialogFilePicker)
If xFiDialog.Show = -1 Then
xPath = xFiDialog.SelectedItems(1)
Set xFiDialog = Nothing
If xPath = "" Then Exit Sub
Set xFso = CreateObject("Scripting.FileSystemObject")
Set xFolder = xFso.GetFile(xPath)
i = 1
For Each xFile In xFolder.Files
i = i + 1
ActiveSheet.Cells(i, 1) = Left(xFile.Name, InStrRev(xFile.Name, ".") - 1)
ActiveSheet.Cells(i, 8) = xPath
I'm really not a programmer but i love how VB works. I've been messing around with it at work to make our lives easier. I tried to do this program but failed hard.
I would appreciate anyone and everyones help on this please.
So the end goal is i want to be able to select individual files in all different kinds of folders and extract there file names and place them into the currently selected empty cell.
Thank you all for reading this and await your thoughts and ideas.