+ Reply to Thread
Results 1 to 6 of 6

Extend Existing Code to Loop Through All Subfolders in a Folder

  1. #1
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Extend Existing Code to Loop Through All Subfolders in a Folder

    Hi all.

    Would appreciate some help from any of our wonderful VBA experts.

    I currently have the following code working, which produces a table of details relating to Outlook messages in a particular folder within my Outlook account:

    Please Login or Register  to view this content.
    Unfortunately the folder on which I wish to run this code ("Deleted Items" here) in reality contains several subfolders, each of which also contain several subfolders, and so on.

    I do not know how to extend this code so that it loops through all subfolders within "Deleted Items" and performs precisely the same task.

    Is anyone able to help here?

    Much appreciated as always.

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Extend Existing Code to Loop Through All Subfolders in a Folder

    Hello XOR LX,

    Maybe this link below, could give something to work with.

    http://www.ozgrid.com/forum/showthread.php?t=65530

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Extend Existing Code to Loop Through All Subfolders in a Folder

    You can use a recursive routine like this:

    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extend Existing Code to Loop Through All Subfolders in a Folder

    Brilliant, Rory.

    Don't understand it (maybe one day!) but it certainly does the job.

    I'm kind of glad you read that manual in your spare time now.

    Cheers

  5. #5
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Extend Existing Code to Loop Through All Subfolders in a Folder

    Quote Originally Posted by Winon View Post
    Hello XOR LX,

    Maybe this link below, could give something to work with.

    http://www.ozgrid.com/forum/showthread.php?t=65530

    Regards.
    Thanks, Winon.

    Appreciate the link. However, even if I manage to generate the list of all subfolders, I wouldn't necessarily know how to include them in my code!

    Besides, appears as if I have what I want now.

    Thanks again.

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Extend Existing Code to Loop Through All Subfolders in a Folder

    It's un-put-downable.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] list of subfolders in folder - without files and sub-subfolders
    By MartyZ in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-11-2022, 10:56 AM
  2. [SOLVED] Code for deleting all files in a folder & its subfolders
    By Swalih in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-17-2014, 03:21 AM
  3. Macro to Loop within all subfolders in a folder in three levels
    By sarakhalatbari in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-22-2011, 06:20 AM
  4. Loop Thru Wkbks in folder and subfolders
    By Diddy in forum Excel General
    Replies: 2
    Last Post: 10-19-2011, 02:25 PM
  5. Macro to loop through subfolders within a root folder upto one level only
    By Roop in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-20-2011, 10:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1