+ Reply to Thread
Results 1 to 11 of 11

Macro to locate folder in a folder and save

Hybrid View

  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
    ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\st\Desktop\" & Sheets("Sheet1").Cells(5, 4) & ActiveWorkbook.Name
    MsgBox "Saved"
    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

    ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\st\Desktop\" & Sheets("Sheet1").Cells(5, 4) & ActiveWorkbook.Name
    MsgBox "Saved"
    Is correct..however add "ODF\" to the FILENAME:= line and a "\" before the activeworkbook.name

    so you have

    ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\st\Desktop\ODF\" & Sheets("Sheet1").Cells(5, 4) & "\" & ActiveWorkbook.Name
    MsgBox "Saved"
    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

+ 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