View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Arvi Laanemets
 
Posts: n/a
Default retrieve filenames from given directory into excel

Hi


wrote in message
oups.com...
I know now what the problem was in the first time. It seems like it
does not work in office 2000


???
I have Office2000 !


Btw., I often use this UDF combined with function ROW(), and another 2
UDF's, which you find below.


--
Arvi Laanemets
( My real mail address: arvi.laanemets<attarkon.ee )

--------------
Public Function GetThisFolder(Optional MyTime As Date)
GetThisFolder = ThisWorkbook.Path
End Function

Public Function GetSubfolder(MyFolder As String, FolderNum As Integer,
Optional MyTime As Date)
Dim fs, f, f1, s, sf
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(MyFolder)
Set sf = f.SubFolders
i = 0
For Each f1 In sf
i = i + 1
If i = FolderNum Then GetSubfolder = f1.Name
Next
End Function