+ Reply to Thread
Results 1 to 8 of 8

Creating Folders and Sub Folders

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Creating Folders and Sub Folders

    Hey,

    I know this may have been asked many times before however I am having trouble with a macro creating folders and subfolders.

    I have attached a spreadsheet with macro that I took from the site which is exactly what I want (if it worked!). The issue I am having is that I can get it to create the parent directory "test" in the location specified however none of the sub folders are created?

    When I initially ran the macro there was a missing reference to "personal.xls" which I removed - maybe this is causing the problem?

    Many thanks in advance,

    Qoios

    file - Make Dir Tree.xlsm

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Creating Folders and Sub Folders

    'MAKE FOLDERS AND SUBFOLDERS
    Here's a macro for creating all the folders and subfolders in a string path. There's a macro and a UDF version that other macros can use.


    Make Folders and Subfolders



    You could simply list the deepest folder:

    C:\Path\To\My\Files\

    ...and it would create every folder in the string if it doesn't exist already.
    Last edited by JBeaucaire; 12-27-2019 at 10:42 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Creating Folders and Sub Folders

    Many thanks for the quick reply.

    I came across that page before funnily enough and whilst it effectively does what I want, the end users only have very basic IT knowledge and dont believe they will be able to understand listing each directory by full path.

    Creating the folders will also be a sporadic but continuing task and therefore I believe that spreadsheet I initially attached is exactly what I need just if only I could get it to work!!

    Any other thoughts?

    Many thanks in advance,

    Q

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Creating Folders and Sub Folders

    No, your sheet is far more plumbing than mine. Not simpler by any means. I was pointing you to a much simpler solution to this common need. We'll see if anyone else wants to work on yours, I'll stay with the simpler one I have already.

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Creating Folders and Sub Folders

    I agree with Jerry, his is far simpler solution for someone to understand. That being said I ran your code in the workbook and it Created the parent and all sub folders.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Creating Folders and Sub Folders

    Change these two lines

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Registered User
    Join Date
    08-17-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Creating Folders and Sub Folders

    Genius! Thanks a million!

    And thank you to everyone else for your help and suggestions.

    Regards,

    Q
    Last edited by JBeaucaire; 10-30-2012 at 12:57 PM. Reason: Removed whole post quotation, unnecessary

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Creating Folders and Sub Folders

    If that takes care of your original query, please select Thread Tools from the menu above and mark the thread as solved. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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