Hi Pavan,
Please try this , give your folder path instead of "C:\PenDrive\", it will
give you folder structure.. I am unable to get the files in UNZIP folder ,I
will come back to you on this.
'===========================================================================
================================
Public ObjFolder As Object
Public objFso As Object
Public objFldLoop As Object
Public lngCounter As Long
Dim objFl As Object
Sub GetFolderStructure()
'
lngCounter = 0
Set objFso = CreateObject("Scripting.FileSystemObject")
Set ObjFolder = objFso.GetFolder("C:\PenDrive\")
Range("A1").Offset(lngCounter).Value = ObjFolder.Path
LoopThroughEachFolder ObjFolder
End Sub
Function LoopThroughEachFolder(fldFolder As Object)
For Each objFldLoop In fldFolder.subFolders
lngCounter = lngCounter + 1
Range("A1").Offset(lngCounter).Value = objFldLoop.Path
LoopThroughEachFolder objFldLoop
Next
End Function
'===========================================================================
================================
Rajan.
-----Original Message-----
From: [email protected] [mailto:[email protected]]
On Behalf Of pavan Kumar
Sent: Apr/Mon/2012 07:45
To: excel-macros
Subject: $$Excel-Macros$$ Folder Structure - VBA Code
HI Group,
I am looking for a VBA code to get the Folder Structure, name and type (the
code also needs to get the folder structure of Zip files too)
Exmpl:
C:\OLD\Main\
C:\OLD\Main\SF1\
C:\OLD\Main\SF1\
C:\OLD\Main\SF1\
C:\OLD\Main\SF1\SF2\
C:\OLD\Main\SF1\SF2\
C:\OLD\Main\SF1\SF2\SF3\
C:\OLD\Main\SF1\SF2\SF3\
C:\OLD\Main\SF1\SF2\SF3\SF4\
C:\OLD\Main\SF1\SF2\SF3\SF4\
Regards,
Pavan kumar G
--
FORUM RULES (986+ members already BANNED for violation)
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security
measure.
4) Acknowledge the responses you receive, good or bad.
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited.
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
----------------------------------------------------------------------------
--------------------------
To post to this group, send email to [email protected]
--
FORUM RULES (986+ members already BANNED for violation)
1) Use concise, accurate thread titles. Poor thread titles, like Please Help,
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited.
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
------------------------------------------------------------------------------------------------------
To post to this group, send email to [email protected]