LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default listing excel file in a folder

Hi Mike,
Thank's,but I don't get the file name list in my worksheet.
Is there something I miss.
Another request,I also want to add the creation date of the
file in my list.
Thank you.

"Mike H" wrote in message
...

Something went wrong in pasting this, try this instead

Sub LoopThroughDirectory()
Application.DisplayAlerts = False
x = 1
MyPath = "C:\" 'Change this to your directory
ActiveFile = Dir(MyPath & "*.xls")
Do While ActiveFile < ""
Cells(x, 1).Value = ActiveFile
x = x + 1
ActiveFile = Dir()
Loop
Application.DisplayAlerts = True
End Sub

Mike
"Mike H" wrote:

Hi,

If all you want is the filename then right click your sheet tab, view

code
and paste this in and run it. Change MyPath to your desired path

Sub LoopThroughDirectory()
Application.DisplayAlerts = False
x = 1
MyPath = "C:\" 'Change this to your directory
ActiveFile = Dir(MyPath & "*.xls")
Do While ActiveFile < ""
Cells(x, 1).Value = ActiveFile
x = x + 1
ActiveFile = Dir()
Application.DisplayAlerts = True
End Sub

Mike

"asrul" wrote:

Hi All,

I want to listing all excel file in a directory.
And put in a worksheet.
How to code it.

Thank's in advance





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Folder listing Esradekan Excel Worksheet Functions 5 March 31st 10 12:33 AM
Listing Folder Contents into a Column LyndieBee Excel Worksheet Functions 1 August 29th 07 03:16 PM
Listing the contents of a folder [email protected] Excel Discussion (Misc queries) 2 April 12th 07 03:54 AM
Followup: Folder listing [email protected] Excel Discussion (Misc queries) 1 February 23rd 07 02:23 AM
Listing files within a folder Jeff Excel Programming 3 December 15th 03 12:28 PM


All times are GMT +1. The time now is 06:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"