Results 1 to 4 of 4
  1. #1
    3 Star Lounger siflaar's Avatar
    Join Date
    Jan 2001
    Location
    Amersfoort, Netherlands
    Posts
    203
    Thanks
    4
    Thanked 0 Times in 0 Posts

    VBA creating folders (Offcie 2003 NL)

    Hello all,

    I have an Excel document with some VBA that is creating some new Excel documents and is storing them in some folders.
    The folder and file names are stored in an array and to overcome errors I check if the folder exists ( <font face="Georgia">fs.folderexsists(fldrarry(n))</font face=georgia> ), and if it isn't then I creat the folder.
    The problem I have is that if the path consists of more folders e.g. "C:/folder1/folder2/folder3" and folder2 and folder3 don't exists it is not possible to create them at ones with the command: <font face="Georgia">fs.createfolder(fldrarray(n))</font face=georgia>
    How could I sove this problem easy?

    Thanks in advance for your reply.
    Greetings,

    Patrick Schouten
    (The Netherlands)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA (Offcie 2003 NL)

    See the CheckFolder procedure in <post:=643,607>post 643,607</post:>. It checks each part of the specified path and creates it if necessary.

  3. #3
    3 Star Lounger siflaar's Avatar
    Join Date
    Jan 2001
    Location
    Amersfoort, Netherlands
    Posts
    203
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Re: VBA (Offcie 2003 NL)

    Cool Hans,
    Quick answer and it is working (ofcourse)
    Greetings,

    Patrick Schouten
    (The Netherlands)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: VBA (Offcie 2003 NL)

    It's pure coincidence that someone else asked exactly the same question very recently.

Posting Permissions

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