View Single Post
  #12   Report Post  
Posted to microsoft.public.excel.programming
cyzax7 via OfficeKB.com cyzax7 via OfficeKB.com is offline
external usenet poster
 
Posts: 16
Default how to create macro that will display the sub_subfolder

Hi,

I' ve solved the prob...
thanxs... ;

Bob Phillips wrote:
Public Sub ListFolders2()
Dim SH As Worksheet
Dim FSO As Object
Dim StartFolder As Object
Dim Fldr As Object
Dim iCtr As Long
Const sName As String = "Home"
Dim sStartDir As String

sStartDir = InputBox( _
Prompt:="Enter the initial directory", _
Default:="C:\")

On Error Resume Next
Set SH = Worksheets(sName)

Set FSO = CreateObject("Scripting.FileSystemObject")
Set StartFolder = FSO.GetFolder(sStartDir)
SH.Cells(1, "A").Value = sStartDir
For Each Fldr In StartFolder.SubFolders
iCtr = iCtr + 1
SH.Cells(iCtr + 1, "A").Value = Fldr.Name
Next Fldr

SH.Columns("A").AutoFit

Set SH = Nothing

End Sub

Hi Cyzax,

[quoted text clipped - 99 lines]

I have tried so many ways, but it doesn't works.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200606/1