Copy Filenames into Excel

  • Thread starter Thread starter steve
  • Start date Start date
S

steve

I need to create an index with comments on a large database of engineering
plans. I would like to copy "just" the filename and if possible the "date
modified" from the plans directory to columns in an excell spreadsheet.

Is this possible

Steve
 
Hi Steve,

Try this,

Sub listFile()

Dim myDir, myFileType, rowCount, first, myFileName, fileDate

myDir = "e:\scrap" ' 'change to suit
myFileType = "*.xls" 'change the extension
rowCount = 1
first = True

Do While True
If first = True Then
myFileName = Dir(myDir + "\" & myFileType)
first = False
Else
myFileName = Dir
End If
If myFileName = "" Then Exit Do
fileDate = Format(FileDateTime(myDir + "\" + myFileName), "dd/mm/yyyy")

Cells(rowCount, "A") = myFileName
Cells(rowCount, "B") = fileDate
rowCount = rowCount + 1
Loop

End Sub

or

You may download my addins "workbook navigation.xla" from below site from
the add-ins page.

http://in.geocities.com/shahshaileshs/

Regards,

Shailesh Shah
http://in.geocities.com/shahshaileshs/
(Excel Add-ins Page)
 
Steve

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

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

http://support.microsoft.com/default.aspx?scid=KB;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 Notepad or
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-ins>Directory
Listing.

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


Gord Dibben MS Excel MVP
 
Thanks for your help Have looked at tushar-mehta add-ins Not sure which one
you are refering to can you advise
Thanks Steve
 
Steve

Apologies........I sent you to Tushar's home page.

Click on Excel Add-ins and find directory listing.


Gord
 
Back
Top