+ Reply to Thread
Results 1 to 7 of 7

Existing File or Not in Folder

  1. #1
    Forum Contributor
    Join Date
    05-23-2017
    Location
    Bang, India
    MS-Off Ver
    MS Office 2007
    Posts
    221

    Existing File or Not in Folder

    I found this code in this forum and tried to modify to create a folder in F drive as “Development”
    and then tried to save an excel file “Collection.xlsm” into that folder.
    I am stuck and unable to move forward. Expert opinion on this is needed.
    What I want to do here are as follows:
    I want to check in the F drive if a folder named “Development” is present already.
    If folder is not present, I want to first Create a Folder named “Development” in that F drive.
    Then now I want to check in the folder “Development” if an excel file “Collection.xlsm” is present; if not present then Create the excel file “Collection.xlsm.”
    If the excel file “Collection.xlsm” is present then to save the file with the current date and system time which has the format “Sunday, 30Jul2017_01-41-33 PM” added to this file and saved as “Collection Sunday, 30Jul2017_01-41-33 PM.xlsm”

    Tried my best to explain it, but your valuable queries on it is welcome.....

    Please Login or Register  to view this content.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Existing File or Not in Folder

    Simple as:
    Please Login or Register  to view this content.
    There's no need to give fancy messages as long as the result is the same every time, the folder and file exist where you want them.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor
    Join Date
    05-23-2017
    Location
    Bang, India
    MS-Off Ver
    MS Office 2007
    Posts
    221

    Re: Existing File or Not in Folder

    hi..Jerry, first of all thank for your response.....i tried using this code into the one...but it is not working as I would like....can you give me the complete redone code.. if not a problem for you...thnk you in advance....

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Existing File or Not in Folder

    That's the whole macro.
    Please Login or Register  to view this content.

  5. #5
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Existing File or Not in Folder

    If you do wanna take the long way.

    Please Login or Register  to view this content.
    Last edited by bakerman2; 07-31-2017 at 09:31 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  6. #6
    Forum Contributor
    Join Date
    05-23-2017
    Location
    Bang, India
    MS-Off Ver
    MS Office 2007
    Posts
    221

    Re: Existing File or Not in Folder

    Thanks jerry, but your macro only creates a Folder "Development" and does not create a file "Collection" with date format...... and it throws up Run-time error 424
    object required.... but bakerman's code works fine the way I wanted...........great.....thanx both of you for your valuable time and also coming with an helping hand at the time needed most....appreciate your knowledge and wisdom...I will close this as solved......added rep too...

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Existing File or Not in Folder

    You're welcome and thanks for rep+.

+ 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. [SOLVED] Excel can't run an existing specific EXE file on system32 folder !! HELP PLZ
    By nkiine in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-27-2017, 05:54 AM
  2. [SOLVED] Modify existing code to select file instead of select folder
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2014, 09:41 AM
  3. name existing on the destination folder
    By LeFootie in forum Excel General
    Replies: 3
    Last Post: 07-05-2012, 11:09 AM
  4. a macro to show all file details existing in a folder.
    By abhay_547 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2010, 09:59 AM
  5. searching folder for existing file
    By TedH in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2009, 05:23 PM
  6. Replies: 6
    Last Post: 08-11-2006, 03:41 PM
  7. macro to move from file to file, folder to folder
    By davegb in forum Excel General
    Replies: 0
    Last Post: 01-21-2005, 04:06 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