Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default listing directory files in a spreedsheet automatically

I have a file on my c drive that contain a lot of documents i need to find a
way to have these files listed in a colum on a spread sheet everytime a file
gets drop into a parent file automatically how can i accomplish this
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 139
Default listing directory files in a spreedsheet automatically

alex:

try it,

Public Sub ListFilesToWorksheet()
On Error Resume Next
Dim stMedd As String
stMedd = "Please Select Folder:"
Set obMapp = CreateObject("Shell.Application").BrowseForFolder( 0,
stMedd, &H1)
If Not obMapp Is Nothing Then
Directory = obMapp.self.Path & "\"
Else
Exit Sub
End If
With Application.FileSearch
.NewSearch
.LookIn = Directory
.Filename = "*.xls"
.SearchSubFolders = True
.Execute
For i = 1 To .FoundFiles.Count
strFileName = Dir(.FoundFiles(i))
strPath = Left(.FoundFiles(i), Len(.FoundFiles(i)) -
Len(strFileName))
strExtension = ""
Cells(i, 1) = .FoundFiles(i)
ActiveSheet.Hyperlinks.Add anchor:=Cells(i, 1),
Address:=.FoundFiles(i)
r = r + 1
Next i
End With

End Sub

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"alex" wrote:

I have a file on my c drive that contain a lot of documents i need to find a
way to have these files listed in a colum on a spread sheet everytime a file
gets drop into a parent file automatically how can i accomplish this

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default listing directory files in a spreedsheet automatically

Hi Chijanzen had a complie error or maybe i did something wrong

"chijanzen" wrote:

alex:

try it,

Public Sub ListFilesToWorksheet()
On Error Resume Next
Dim stMedd As String
stMedd = "Please Select Folder:"
Set obMapp = CreateObject("Shell.Application").BrowseForFolder( 0,
stMedd, &H1)
If Not obMapp Is Nothing Then
Directory = obMapp.self.Path & "\"
Else
Exit Sub
End If
With Application.FileSearch
.NewSearch
.LookIn = Directory
.Filename = "*.xls"
.SearchSubFolders = True
.Execute
For i = 1 To .FoundFiles.Count
strFileName = Dir(.FoundFiles(i))
strPath = Left(.FoundFiles(i), Len(.FoundFiles(i)) -
Len(strFileName))
strExtension = ""
Cells(i, 1) = .FoundFiles(i)
ActiveSheet.Hyperlinks.Add anchor:=Cells(i, 1),
Address:=.FoundFiles(i)
r = r + 1
Next i
End With

End Sub

--
天行健,君*以自強不息
地勢坤,君*以厚德載物

http://www.vba.com.tw/plog/


"alex" wrote:

I have a file on my c drive that contain a lot of documents i need to find a
way to have these files listed in a colum on a spread sheet everytime a file
gets drop into a parent file automatically how can i accomplish this

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
Directory listing Bampah Excel Discussion (Misc queries) 4 January 19th 06 03:25 PM
Listing Directory Contents in Worksheet Pablo Excel Discussion (Misc queries) 2 August 2nd 05 06:09 PM
Directory listing Nigel Chapman Excel Discussion (Misc queries) 2 April 15th 05 02:52 PM
Directory listing manipulation [email protected] Excel Programming 5 December 9th 04 11:01 AM
Recursive directory listing Jim[_47_] Excel Programming 2 September 16th 04 10:55 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"