+ Reply to Thread
Results 1 to 3 of 3

Creating a new folder

  1. #1
    Registered User
    Join Date
    03-02-2006
    Posts
    54

    Creating a new folder

    Hi, I've written a code that pulls raw data into a variety of different workbooks, as this is happening i wuld also like to create an audit trail which includes the original filename and todays date. I believe that i can do this in some fashion already.

    It would probably be best if when a new trail is created all the associated files are saved in the same folder, preferabley with todays date. What is the best way to create a new folder from vba,

    I was thinking something along the lines of

    string1 = workbook.fullname and format(date)

    mkdir string1

    But ive also heard about filesys.createfolder ?

    Has anyone else been faced with a similar task?

  2. #2
    Bob Phillips
    Guest

    Re: Creating a new folder

    Go with MkDir. It is simple and works.

    --
    HTH

    Bob Phillips

    (remove xxx from email address if mailing direct)

    "cereldine" <cereldine.27nhyn_1147363809.1136@excelforum-nospam.com> wrote
    in message news:cereldine.27nhyn_1147363809.1136@excelforum-nospam.com...
    >
    > Hi, I've written a code that pulls raw data into a variety of different
    > workbooks, as this is happening i wuld also like to create an audit
    > trail which includes the original filename and todays date. I believe
    > that i can do this in some fashion already.
    >
    > It would probably be best if when a new trail is created all the
    > associated files are saved in the same folder, preferabley with todays
    > date. What is the best way to create a new folder from vba,
    >
    > I was thinking something along the lines of
    >
    > string1 = workbook.fullname and format(date)
    >
    > mkdir string1
    >
    > But ive also heard about filesys.createfolder ?
    >
    > Has anyone else been faced with a similar task?
    >
    >
    > --
    > cereldine
    > ------------------------------------------------------------------------
    > cereldine's Profile:

    http://www.excelforum.com/member.php...o&userid=32069
    > View this thread: http://www.excelforum.com/showthread...hreadid=541158
    >




  3. #3
    Barry-Jon
    Guest

    Re: Creating a new folder

    It sounds like you are referring to the Scripting runtimes
    FileSystemObject. It is worth using as it wraps a lot of oft-needed
    functionality in a very easy to use manner. To use it you need to
    reference the library from the VBA editor by going to Tools ->
    References... From there you should find "Microsoft Scipting Runtime",
    check the box and you're ready to go. An example of doing what you
    wanted is below. I would highly recommend searching for
    filesystemobject in the vba help - it's a great resource. Is this what
    you were thinking of?

    Sub CreateDirectory(Path As String)

    Dim fso As Scripting.FileSystemObject

    Set fso = New Scripting.FileSystemObject

    fso.CreateFolder (Path)

    End Sub


+ 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