Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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
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
Using FoundFiles to list by path and filename Jon[_21_] Excel Programming 2 April 15th 06 06:41 PM
Create and import filename list into excel Jim Semaj Excel Programming 3 December 12th 05 06:05 PM
Filename list into Excel Fred Excel Discussion (Misc queries) 4 September 12th 05 04:01 PM
The available macros list in XL; how to suppress filename from showing KR Excel Discussion (Misc queries) 1 January 10th 05 07:20 PM
How to import a path/filename when importing data into an XML list cxparker Excel Worksheet Functions 0 December 7th 04 10:13 PM


All times are GMT +1. The time now is 09:27 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"