+ Reply to Thread
Results 1 to 7 of 7

Macro to Create Folder\Sub Folder\SubFolder\

  1. #1
    Registered User
    Join Date
    02-08-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    80

    Macro to Create Folder\Sub Folder\SubFolder\

    Hi,

    Can i please ask for assistant.

    I am trying to create a macro for button.

    Please Login or Register  to view this content.
    I know i have to use MKDIR but don't know how to write the code.

    Column B Column C
    Row 5 Drive Directory C
    Row 6 Main Folder Bills
    Row 7 Sub Folder 1 Insurance
    Row 8 Sub Folder 2 Car
    Row 9 Sub Folder 3 Ford
    Row 10 Sub Folder 4 Max
    Row 11 Sub Folder 5
    Row 12 Sub Folder 6
    Row 13 Sub Folder 7
    Row 14 Sub Folder 8
    Row 15 Sub Folder 9
    Row 16 Sub Folder 10

    As you see above user will enter the in column C drive\folder\sub folder\ etc.

    cell B3 shows wahts the path will look like.

    C:\Bills\Insurance\Car\Ford\Max\
    If the folder exsit the display as meassage "Folder Exist - Please recheck".

    I have attached file.
    Attached Files Attached Files

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro to Create Folder\Sub Folder\SubFolder\

    You cannot use MkDir to make complex directories as in your example, The main directory must already exist

    If you want to create directory such as C:\TestMacro\Bills
    , TestMacro must exist & the Function would create a subdirectory - Bills, in it

    So this code will create the subdirectory if B2 produces C:\TestMacro\Bills & testMacro already exists
    [
    Please Login or Register  to view this content.
    Last edited by royUK; 08-22-2009 at 10:59 AM.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    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: Macro to Create Folder\Sub Folder\SubFolder\

    Try this:
    Please Login or Register  to view this content.
    Last edited by shg; 08-22-2009 at 11:19 AM.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    02-08-2009
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    80

    Re: Macro to Create Folder\Sub Folder\SubFolder\

    Thank you very much works a treat.

    Many Thanks
    Last edited by shg; 08-22-2009 at 12:38 PM. Reason: deleted spurious quote

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro to Create Folder\Sub Folder\SubFolder\

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  6. #6
    Registered User
    Join Date
    08-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Macro to Create Folder\Sub Folder\SubFolder\

    How can I modify this macro to create multiple folders and subfolders?

  7. #7
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Macro to Create Folder\Sub Folder\SubFolder\

    Hello Hkortam, and welcome to the forum.

    Unfortunately you have inadvertently broken one of the forum rules. Please read the following and make the necessary change. Thanks.

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

+ 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