+ Reply to Thread
Results 1 to 7 of 7

Select the correct folder for the current month

  1. #1
    Registered User
    Join Date
    06-17-2013
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    9

    Select the correct folder for the current month

    Hi,

    I'm trying to save the file to the correct folder. The folder is located on the "Folder Name/MM-YYYY" I would like the code to be able to dynamically select the current month's folder when they try to save the file.

    Please Login or Register  to view this content.
    Last edited by Leith Ross; 07-16-2013 at 12:34 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Select the correct folder for the current month

    Hi, jksung5295,

    as you are working with Strings you should use the ampersand for concatenating strings.

    Give this a try:
    Please Login or Register  to view this content.
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    06-17-2013
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Select the correct folder for the current month

    Awesome, that does what it is suppose to.

    One more things, if the folder is not already created, is there a way to create the folder and then open that new folder?

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Select the correct folder for the current month

    Hi, jksung5295,

    like this:
    Please Login or Register  to view this content.
    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    06-17-2013
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Select the correct folder for the current month

    Len(Dir(strPath, 16)) = 0

    what is this function doing? How is that checking to see if the directory is available?

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Select the correct folder for the current month

    Hi, jksung5295,

    it will check the folder and return a value of 0 if the folder does not exist while it shoul dreturn a value greater than 0 if the folder is already present. From what I noticed in your code I noticed there is no root in the string you´re bukdling so you might run into trouble using the code. If you´re working on a machine with a mapped drive maybe try instead
    Please Login or Register  to view this content.
    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    06-17-2013
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    9

    Re: Select the correct folder for the current month

    Thank you so much for your help. I was able to get your first code to work by modifying the address a little bit. Thanks bunch for your help! Works as advertised

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 08-13-2012, 11:18 AM
  2. Replies: 1
    Last Post: 01-24-2006, 11:35 AM
  3. Replies: 1
    Last Post: 01-24-2006, 11:00 AM
  4. Replies: 1
    Last Post: 01-24-2006, 12:25 AM
  5. UserForm to select current month or earlier
    By Steve in forum Excel General
    Replies: 4
    Last Post: 01-23-2005, 05:33 PM

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