thanks a lot setiyowati.devi
the files is working and its very good regrds LKModi On Fri, Jul 1, 2011 at 4:59 AM, STDEV(i) <setiyowati.d...@gmail.com> wrote: > please check the attached file, and see if it helps > > '------------------------------------- > > Sub ListFilesNameOfSpecifiedFolder() > '------------------------------------------ > ' siti Vi / Excel FileName List of a folder > ' ext: *.xl?? > ' jakarta, 21 april 2008 > '------------------------------------------ > Dim fBrowser As BrowseInfo > Dim PathDirNm As String > Dim szTitle As String > Dim lpIDList As Long > Dim FSO As Object > Dim FOL As Object > Dim MyFile As Object > Dim r As Integer > > '----select a folder via BrowseInfo)---------- > szTitle = "©tv: Please Select a Folder..." > With fBrowser > .hWndOwner = Application.Hwnd > .lpszTitle = lstrcat(szTitle, "") > .ulFlags = BI_RetuOnlyFSDir + BI_NoGoBelowDomain > End With > lpIDList = SHBrowseForFolder(fBrowser) > If (lpIDList) Then > PathDirNm = Space(Max_Path) > SHGetPathFromIDList lpIDList, PathDirNm > PathDirNm = Left(PathDirNm, InStr(PathDirNm, vbNullChar) - 1) > Range("D2") = PathDirNm ' for info only in sheet > End If > > '---- fileName list to sheet-------------- > On Error GoTo Akhir > Set FSO = CreateObject("Scripting.FileSystemObject") > Set FOL = FSO.GetFolder(PathDirNm).Files > Range("D6") = "." > Range("C5").CurrentRegion.Offset(1, 0).ClearContents > ' - loop thru all file in files collection > For Each MyFile In FOL > If LCase(Right(MyFile.Name, 4)) Like "*xl*" Then > r = r + 1 > Range("B6").Cells(r, 1) = r > ' - get the name and write to cell > Range("B6").Cells(r, 2) = MyFile.Name > Range("B6").Cells(r, 4) = MyFile.Size / 1024 > End If > Next > Akhir: > End Sub > '------------------------------ > > > > > On Thu, Jun 30, 2011 at 3:10 PM, L.K. Modi <ca.mod...@gmail.com> wrote: > >> Dear GroupMembers, >> >> I want to list the file name that are in closed folder .Means any way by >> which i can get the files or workboooks name that are in a particular >> folder. >> >> Thanks in advance >> >> Regards >> LKModi >> >> > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel