+ Reply to Thread
Results 1 to 11 of 11

Macro to locate folder in a folder and save

  1. #1
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Macro to locate folder in a folder and save

    hi guys im looking for some code to save to a destination

    destination address is
    C:\Documents and Settings\st\Desktop\OJF

    now the problem is OJF has folders named 1 to 500

    so if cell d5 = 487 it will need to look in the above desination and then open the folder and save it there

    kind regards
    Last edited by excellentexcel; 04-13-2009 at 11:34 AM.

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Macro to locate folder in a folder and save

    Hi
    try this code
    Please Login or Register  to view this content.
    Ravi

  3. #3
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: Macro to locate folder in a folder and save

    Thats not worked ravi
    its saved it to desktop and not in the folder i requested

  4. #4
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: Macro to locate folder in a folder and save

    Please Login or Register  to view this content.
    Is correct..however add "ODF\" to the FILENAME:= line and a "\" before the activeworkbook.name

    so you have

    Please Login or Register  to view this content.
    This will then save in the ODF folder...and the folder identified by d5
    Last edited by GuruWannaB; 04-13-2009 at 10:38 AM. Reason: updated macro with: "\" &

  5. #5
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: Macro to locate folder in a folder and save

    I HAVE MANAGED TO GET IT TO SAVE ALMOST IN THE RIGHT FOLDER
    ITS NOW SAVING TO C:\Documents and Settings\st\Desktop\OJF\

    BUT ITS NOT OPENING THE FOLDER WITHIN THE ODF FOLDER IN THIS CASE
    1

    ITS ALSO SAVING AS
    1Supply only trail
    where as i want it to save in the right folder which is 1
    but i also want it to save as "1 parking form"
    Last edited by excellentexcel; 04-13-2009 at 10:37 AM.

  6. #6
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: Macro to locate folder in a folder and save

    recheck the formula I gave above...I updated it right as you posted...sorry.

    You need the "\" before the actual activeworkbook name portion of the code.
    Last edited by GuruWannaB; 04-13-2009 at 10:53 AM.

  7. #7
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: Macro to locate folder in a folder and save

    hi guru
    that now works perfectly and finds the folder rightly

    the only thing i need it to do now is name it differently

    i want it to save as

    1 parking form

  8. #8
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: Macro to locate folder in a folder and save

    Ok...Where does the name of the file derived from? A cell?

    We got the folder name from a cell...can do the same for the file name or do you want to choose everytime what the name will be...just having the saveas box populate to the proper folder?

    Right now it is saving with that name because it is the current default name of the file you are modifying. Manually save it as the filename you want...and it will default to that name going forward...but you can automate it to change the file name based on a cell value too - or make it a selectable everytime. Your choice.
    Last edited by GuruWannaB; 04-13-2009 at 10:59 AM.

  9. #9
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: Macro to locate folder in a folder and save

    the name of the cell should derive from sheet "PARKING & ACCESS" this is actually the only sheet left after previous macro work

    and the number is from cell c6 of that sheet

    all i need after that is " parking form" exactly as it is

    so lets say 487
    it would save as 487 parking form

  10. #10
    Forum Contributor GuruWannaB's Avatar
    Join Date
    01-24-2008
    Location
    An hour due East of Cowtown Ohio
    MS-Off Ver
    2010
    Posts
    421

    Re: Macro to locate folder in a folder and save

    Gotchya..here we go

    Please Login or Register  to view this content.
    This still points to D5 for the folder name...as did those above...but if you need to change that to C6 - then change the code highlighted in blue to "CELLS(6, 3)"
    Last edited by GuruWannaB; 04-13-2009 at 11:16 AM. Reason: Missed putting the number in front of the file name...corrected this.
    I help because of the Pavlovian dog that resides in the inner me...so if you are happy with the results, please add to my reputation. It helps keep me motivated!



    Please mark your threads as Solved once it is solved. Check the FAQ's to see how.

  11. #11
    Forum Contributor
    Join Date
    01-06-2009
    Location
    uk
    MS-Off Ver
    Excel 2007
    Posts
    415

    Re: Macro to locate folder in a folder and save

    works a treat
    thank you so much
    much appreciated

+ 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