Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
List FileName
I have a big folder which contants a lot of doc files, whose has some stable
name rule. To make a filter to those file, I'd like to prepare a list which contains all of the file name in this folder. I am able to use VBA, but have no idea which function to use. Could help me? What's more, if the function could search via subfolder, that will be better. Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
List FileName
The code here will do what you want
http://www.vbaexpress.com/kb/getarticle.php?kb_id=800 Mike "ViestaWu" wrote: I have a big folder which contants a lot of doc files, whose has some stable name rule. To make a filter to those file, I'd like to prepare a list which contains all of the file name in this folder. I am able to use VBA, but have no idea which function to use. Could help me? What's more, if the function could search via subfolder, that will be better. Thanks! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
List FileName
Sub SubGetMyData()
Const BASE_FOLDER As String = "C:\personal\Bob" '<=== change to suit Dim objFSO As Object Dim objFolder As Object Dim objSubfolder As Object Dim objFile As Object Dim iRow As Long Dim sh As Worksheet iRow = 3 On Error Resume Next Set sh = Worksheets("_filelist") On Error GoTo 0 If sh Is Nothing Then Worksheets.Add.Name = "_filelist" Set sh = Worksheets("_filelist") End If sh.Cells.Clear iRow = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(BASE_FOLDER) For Each objFile In objFolder.Files If objFile.Type Like "*Microsoft*Word*" Then sh.Cells(iRow, "A").Value = objFile.Path iRow = iRow + 1 End If Next End Sub -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "ViestaWu" wrote in message ... I have a big folder which contants a lot of doc files, whose has some stable name rule. To make a filter to those file, I'd like to prepare a list which contains all of the file name in this folder. I am able to use VBA, but have no idea which function to use. Could help me? What's more, if the function could search via subfolder, that will be better. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Using FoundFiles to list by path and filename | Excel Programming | |||
Create and import filename list into excel | Excel Programming | |||
Filename list into Excel | Excel Discussion (Misc queries) | |||
The available macros list in XL; how to suppress filename from showing | Excel Discussion (Misc queries) | |||
How to import a path/filename when importing data into an XML list | Excel Worksheet Functions |