# Microsoft Office Application Help - Excel Help forum > Excel Programming / VBA / Macros >  >  List files in folder

## scubajon

Greetings one and all
Everyone must start somewhere so I choose to start on this old post since it happens to applicable to my stumbling block. I too needed to list all the files, folders and subfolders in a given directory and was able to find a pair of macros on the web which gave me most of what I needed (plagiarism is a wonderful thing) and then with a bunch of modification I came up with the macros below. My problem is in the second macro (ListFilesInFolder). I have been unable to get Microsoft to give up the file "owner" (Person who created the file) to my spreadsheet. I can see it just fine when I am in that folder, I just can't get it into my excel file. The line that is giving me the trouble is:




```
Please Login or Register  to view this content.
```


Does anyone know what I need to do to make this work?
Randy P



Here are the macros:




```
Please Login or Register  to view this content.
```





```
Please Login or Register  to view this content.
```

----------


## Leith Ross

Hello scubajon,

I modified your macro *ListFilesInFolder* to include the call to the new macro *GetFileOwner*. The macros now use late binding. This allows them to run directly without having to remember to set a project reference to the object libraries. It will run a little slower this way, but simplifies interoperability. The problem with plagiarism is you never know if the information is correct.

*ListFilesInFolder Macro*



```
Please Login or Register  to view this content.
```


*GetFileOwner Macro*



```
Please Login or Register  to view this content.
```


Sincerely,
Leith Ross

----------


## scubajon

Thanks Leith
It will be a couple days before I can get back to this project but I look forward to implementing your code.

Randy Pedersen
Boeing/Everett

----------


## scubajon

Leith
I put it in place, ran it and with one minor modification, it worked great! I had to change the objFolderItem from "8" to "9". That's an easy change. Thank you again for your help.
Randy

----------


## jamessmith1330

Leith,

how would I modidy this so that it only lists excel files rather than all files, and it then cleans out all files which don't contain a certain phrase?

----------


## Fotis1991

Welcome to the forum. Unfortunately:

Unfortunately _your post does not comply with Rule 2 of our Forum_ RULES. *Do not post a question in the thread of another member -- start your own thread.* 

If you feel an existing thread is particularly relevant to your need, provide a link to the other thread in your new thread. 

Old threads are often only monitored by the original participants.  New threads not only open you up to all possible participants again, they typically get faster response, too.

----------

