+ Reply to Thread
Results 1 to 9 of 9

Creating a directory

  1. #1
    Registered User
    Join Date
    04-29-2004
    Posts
    92

    Creating a directory

    Hello exceltip! Its been a while since weve talked

    I dont have time to search right now so im just going to quickly post this question.

    I need to make a macro that does the following:
    1. Create a directory based on the date, and save file to directory.
    2. If the directory exists then write the file to the directory.

    Should be pretty simple and thanks for the help!
    Justchris
    Last edited by justchris; 09-14-2006 at 07:10 PM.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525
    is it really helping if somebody does it for you?

  3. #3
    Registered User
    Join Date
    04-29-2004
    Posts
    92
    Quote Originally Posted by davesexcel
    is it really helping if somebody does it for you?
    Thanks dave!

  4. #4
    Registered User
    Join Date
    04-29-2004
    Posts
    92
    Ok, well... there should be a way to do it right? I searched here on the forums but didnt come up with anything. I know how to save the file as a cell name but Im not sure on the creating of the directory. Or verifing the directory exists. Any help would be awesome. Im doing this for and its not really that important but it would definatly stream line my data entry process.

    Thanks in advance
    Chris

  5. #5
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.

  6. #6
    Registered User
    Join Date
    04-29-2004
    Posts
    92
    Thanks a lot colofnature, really appreciate it! That will be extremly helpfull in streaming lining what I do

    Chris

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525
    Quote Originally Posted by justchris
    Hello exceltip! Its been a while since weve talked

    I dont have time to search right now so im just going to quickly post this question.........................

    Should be pretty simple and thanks for the help!.

    Justchris
    When you admit you are too lazy to find the solution yourself, and then say it should be pretty simple.. and don't supply any effort into the solution...
    How is anybody going to respond to that!!!
    There are a lot of people who try create what they need, and come into a barrier, then they require help, when they don't put any effort into it, and expect others to do it for them, how does one respond to that??

  8. #8
    Registered User
    Join Date
    04-29-2004
    Posts
    92
    Quote Originally Posted by davesexcel
    When you admit you are too lazy to find the solution yourself, and then say it should be pretty simple.. and don't supply any effort into the solution...
    How is anybody going to respond to that!!!
    There are a lot of people who try create what they need, and come into a barrier, then they require help, when they don't put any effort into it, and expect others to do it for them, how does one respond to that??

    You know what dave, you seem like an as* If you dont think I searched then your also an idiot. Please dont post anything in any of my threads again. This site is for asking for help, which is precisely what Im doing. You are obviously a jerk and have nothing nice to say to me. I am not a visual basic master and so I come here to ask questions on things that I am not sure about. If YOU have a problem with that please restrain from taking it out on me. Good day

  9. #9
    Registered User
    Join Date
    04-29-2004
    Posts
    92
    Since it had a lot of views and its one I'm sure others will want to use this heres the solution. Can probably do the date diffrently but owell does what I need it too

    Dim SaveName As String
    Dim foldername As String
    foldername = Sheet1.Range("h1").Text
    If Dir("C:\bnsf\" & foldername, vbDirectory) = "" _
    Then MkDir "C:\bnsf\" & foldername Else
    SaveName = ActiveSheet.Range("b6").Text
    ActiveWorkbook.SaveAs Filename:="c:\bnsf\" & foldername & "\" &
    SaveName & ".xls"


    This uses the cell h1 which uses the =now() function and is formated as mar-01 to create a directory based on the date I am working on the file. Then it uses another cell on the sheet as the file name.

    Hope that helps some people
    Chris

+ 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