ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Import file names into cells (https://www.excelbanter.com/excel-worksheet-functions/5488-import-file-names-into-cells.html)

craigwojo

Import file names into cells
 

Hi everyone,

I need to take file names from directories on my hard dirve and import
the file name into a cell. I don't want to type all the file names
into each cell. Also if I add a file to the directory I would like it
to update the excel sheet and put the file in the correct place. If
the second part is hard to understand, forget about it, I really need
the first part of this question.

Thank you,
Craig


--
craigwojo
------------------------------------------------------------------------
craigwojo's Profile: http://www.excelforum.com/member.php...o&userid=13767
View this thread: http://www.excelforum.com/showthread...hreadid=274415


Don Guillett

This macro will make a list of all files in "yourfolder". Change to suit. If
you only want excel files, uncomment the .filename line.

With Application.FileSearch
.NewSearch
.LookIn = "c:\YourFolder"
'.SearchSubFolders = True 'False
'.FileName = ".xls" 'Your file types
If .Execute 0 Then
For iCtr = 1 To .FoundFiles.Count
Cells(iCtr, 1).Value = .FoundFiles(iCtr)
Next iCtr
End If
End With


--
Don Guillett
SalesAid Software

"craigwojo" wrote in message
...

Hi everyone,

I need to take file names from directories on my hard dirve and import
the file name into a cell. I don't want to type all the file names
into each cell. Also if I add a file to the directory I would like it
to update the excel sheet and put the file in the correct place. If
the second part is hard to understand, forget about it, I really need
the first part of this question.

Thank you,
Craig


--
craigwojo
------------------------------------------------------------------------
craigwojo's Profile:

http://www.excelforum.com/member.php...o&userid=13767
View this thread: http://www.excelforum.com/showthread...hreadid=274415




Gord Dibben

Craig

Several methods to accomplish this.......I like Tushar's best.

To add a "Print Directory" feature to Explorer, go to
this KB Article.

http://support.microsoft.com/default...EN-US;q272623&

Or you can download Printfolder 1.2 from.....

http://no-nonsense-software.com/freeware/

I use PF 1.2 and find it to be more than adequate with custom features.

OR Go to DOS(Command) prompt and directory.
Type DIR MYFILES.TXT

All the above create a *.TXT file which can be opened in Excel.

One more method if you want to by-pass the *.TXT file and pull directly to
Excel is to use Tushar Mehta's Excel Add-in. This allows filtering and
sorting once you have the data in Excel.

http://www.tushar-mehta.com/ scroll down to Add-insDirectory Listing.

Download the ZIP file and un-zip to your Office\Library folder.

As to the second part of mission........the updating part......I think you
would just have to re-import all filenames again from the folder.

Gord Dibben Excel MVP

On Mon, 1 Nov 2004 20:29:42 -0600, craigwojo
wrote:


Hi everyone,

I need to take file names from directories on my hard dirve and import
the file name into a cell. I don't want to type all the file names
into each cell. Also if I add a file to the directory I would like it
to update the excel sheet and put the file in the correct place. If
the second part is hard to understand, forget about it, I really need
the first part of this question.

Thank you,
Craig




All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com