Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
hyperlink to directory folder while highlighting filename | Links and Linking in Excel | |||
hyperlink to directory folder while highlighting filename | Excel Discussion (Misc queries) | |||
open filename containing specific characters in known folder | Excel Programming | |||
how do i display a preview of an excel file in a document folder? | Excel Discussion (Misc queries) | |||
filename with folder | Excel Worksheet Functions |