Ah,, Got the problem actually I have call Another Function , Now you can
check 

Rajan



-----Original Message-----
From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of pavan Kumar
Sent: Apr/Mon/2012 09:04
To: excel-macros@googlegroups.com
Subject: Re: $$Excel-Macros$$ Folder Structure - VBA Code

HI Rajan,

Please find the attached file.I have run the macro and unable to get the
folder contains of the C:\Documents and Settings\pavan\Desktop\New
Folder\Gk\Copy of Gk which also contians A & B xls.

Regards,
Pavan Kumar G

On 4/16/12, Rajan_Verma <rajanverma1...@gmail.com> wrote:
> Please find attached sheet, I think its iterating each sub folders and 
> files.
>
> Rajan
>
> -----Original Message-----
> From: excel-macros@googlegroups.com 
> [mailto:excel-macros@googlegroups.com]
> On Behalf Of pavan Kumar
> Sent: Apr/Mon/2012 08:51
> To: excel-macros@googlegroups.com
> Subject: Re: $$Excel-Macros$$ Folder Structure - VBA Code
>
> HI Rajan,
>
> Awesome its working fine as per my requirement, need a small 
> correction, the subfolder's is not working for more than one folder, 
> sorry I am not so good @ VBA hence I can get it on my own so I am 
> troubling you. I require to have the last continent of each folder.
> Example :
> Main Folder
> Subfolder 1
> Subfolder 2
>       Subfolder 2.3
>                 Subfolder 2.4
>
> Thanks and regards,
> Pavan Kumar G
>
>
> On 4/16/12, Rajan_Verma <rajanverma1...@gmail.com> wrote:
>> So basically you want 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")
>>     With Application.FileDialog(msoFileDialogFolderPicker)
>>         .Show
>>         Set ObjFolder = objFso.GetFolder(.SelectedItems(1))
>>     End With
>>     ActiveSheet.UsedRange.ClearContents
>>     Range("A1:B1").Value = Array("Folder", "Files")
>>     Range("A1").Offset(lngCounter).Value = ObjFolder.Path
>>     LoopThroughEachFolder1 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
>>
>>
>> Function LoopThroughEachFolder1(fldFolder As Object)
>>
>>     For Each objFldLoop In fldFolder.subFolders
>>     lngCounter = lngCounter + 1
>>     Range("A1").Offset(lngCounter).Value = objFldLoop.Path
>>              For Each objFl In objFldLoop.Files
>>                 Range("A1").Offset(lngCounter, 1).Value = objFl.Name
>>                 lngCounter = lngCounter + 1
>>              Next
>>     LoopThroughEachFolder objFldLoop
>>     Next
>> End Function
>>
>> -----Original Message-----
>> From: excel-macros@googlegroups.com
>> [mailto:excel-macros@googlegroups.com]
>> On Behalf Of pavan Kumar
>> Sent: Apr/Mon/2012 08:20
>> To: excel-macros@googlegroups.com
>> Subject: Re: $$Excel-Macros$$ Folder Structure - VBA Code
>>
>> HI Rajan,
>>
>> Thanks for the replay, its working fine, i need little more help on 
>> the same, i like to have the folder contains in the next colm(forgot 
>> to mention in my earlier mails).
>>
>> Thanks and Regards,
>> Pavan Kumar G
>>
>> On 4/16/12, Rajan_Verma <rajanverma1...@gmail.com> wrote:
>>> 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: excel-macros@googlegroups.com
>>> [mailto:excel-macros@googlegroups.com]
>>> 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 excel-macros@googlegroups.com
>>>
>>> --
>>> 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 excel-macros@googlegroups.com
>>>
>>
>> --
>> 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 excel-macros@googlegroups.com
>>
>> --
>> 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 
>> excel-macros@googlegroups.com
>>
>
> --
> 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 excel-macros@googlegroups.com
>
> --
> 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 
> excel-macros@googlegroups.com
>

--
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 excel-macros@googlegroups.com

-- 
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 excel-macros@googlegroups.com

Attachment: Copy of LoopingEachFolderandFIles.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12

Reply via email to