Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How do I display all the filename in a folder in excel ?

How do I display all the filename in a folder in excel ?
Example : In c:\abc folder got filename file1.txt , file2.txt and file3.txt

How do I display in excel in the following order :-
c:\abc\file1.txt
c:\abc\file2.txt
c:\abc\file3.txt

Regards,
Tee



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,549
Default How do I display all the filename in a folder in excel ?


Sub ListAllFilesInFolder()
'Jim Cone - Portland Oregon - USA
Dim strPath As String
Dim oFSO As Object
Dim oFile As Object
Dim oFolder As Object
Dim N As Long

strPath = "C:\Program Files\Microsoft Office\Office11"

N = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(strPath)
Cells(N, 1).Value = oFolder.Path
N = N + 1
For Each oFile In oFolder.Files
Cells(N, 2).Value = oFile.Name
N = N + 1
Next 'oFile
Set oFSO = Nothing
Set oFile = Nothing
Set oFolder = Nothing
End Sub
--
Jim Cone
Portland, Oregon USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins - free trial of "List Files" - no registration)




"Eng Teng"
wrote in message
How do I display all the filename in a folder in excel ?
Example : In c:\abc folder got filename file1.txt , file2.txt and file3.txt
How do I display in excel in the following order :-
c:\abc\file1.txt
c:\abc\file2.txt
c:\abc\file3.txt
Regards,
Tee
Reply
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
hyperlink to directory folder while highlighting filename locojester Links and Linking in Excel 1 February 10th 10 08:27 AM
hyperlink to directory folder while highlighting filename locojester Excel Discussion (Misc queries) 0 February 10th 10 12:01 AM
open filename containing specific characters in known folder Spike Excel Programming 3 November 8th 06 04:16 PM
how do i display a preview of an excel file in a document folder? medici Excel Discussion (Misc queries) 1 May 11th 06 12:00 AM
filename with folder Steve Mackay Excel Worksheet Functions 3 November 1st 04 05:58 PM


All times are GMT +1. The time now is 05:47 AM.

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

About Us

"It's about Microsoft Excel"