Returning Path of Files

jaynorman46

New Member
Joined
Apr 5, 2011
Messages
23
Hi,

I have over 15,000 files on a file share. I am looking to try and extract the path for each individual one and paste it in a long list on a sheet with its associated folder. I'm having a hard time of where to start. the most difficult part is there are thousands of folders and different types of files as well. I have 35 master folders with sub folders within.



My eventual goal is to create an easy to access index on an excel sheet. Once I have all the Paths I can create Hyperlinks to the exact file for one click viewing.


Is this even possible?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,651
Maybe a start?

Code:
Sub ListFiles2()
Dim MyFolder As String
Dim MyFile As String
Dim j As Integer
With Application.FileDialog(msoFileDialogFolderPicker)
    .AllowMultiSelect = False
    .Show
    MyFolder = .SelectedItems(1)
End With
MyFile = Dir(MyFolder & "\*.xls")
Do While MyFile <> ""
    j = j + 1
    Cells(j, 1).Value = MyFile
    MyFile = Dir
Loop
End Sub
 

jaynorman46

New Member
Joined
Apr 5, 2011
Messages
23
Thanks for replying!

just for clarification I need to give myfolder a value? and can I do this with .pdf and .jpg?
 

jaynorman46

New Member
Joined
Apr 5, 2011
Messages
23
Ok, I see what the program you wrote does now. I dont want to be prompted for each folder. I have 1,463 folders to do this with is there anyway that this step could be automatic?
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,651
You could create a list of folders on a sheet then loop through those values.

There is no 'magic' solution as far as I know.
 

Forum statistics

Threads
1,082,168
Messages
5,363,537
Members
400,747
Latest member
monty_gl

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top