+ Reply to Thread
Results 1 to 8 of 8

Modify Macro To Save In To Another Folder

  1. #1
    Forum Contributor
    Join Date
    07-07-2008
    Location
    sCOTLAND
    MS-Off Ver
    Office 2003 SP3
    Posts
    256

    Modify Macro To Save In To Another Folder

    Hi

    Can someone please help me with this?

    I have a macro listed below, all the maco does is save a back up of the file i am saving just incase the file gets overwritten by mistake.

    At the moment the back up file saves to the same directory as the workbook being saved, i would like it to save to a folder in the same directory called "Back Up" but i am having problems doing this. I do not want to put in the C:\Directory\Filename all i want to do is save to the folder "Back Up" in the same directory as the orig file no matter where it is.

    Please Login or Register  to view this content.
    Last edited by JimmiOO; 11-15-2010 at 04:40 AM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Modify Macro To Save In To Another Folder

    Hi JimmiOO

    Something like this may work
    Please Login or Register  to view this content.
    Hope this helps.

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

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

    Re: Modify Macro To Save In To Another Folder

    Perhaps the SaveCopyAs method?

    Please Login or Register  to view this content.
    _________________
    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!)

  4. #4
    Forum Contributor
    Join Date
    07-07-2008
    Location
    sCOTLAND
    MS-Off Ver
    Office 2003 SP3
    Posts
    256

    Re: Modify Macro To Save In To Another Folder

    Quote Originally Posted by jaslake View Post
    Hi JimmiOO

    Something like this may work
    Please Login or Register  to view this content.
    Hope this helps.

    John
    Hi John i tried to fit this into my code but can,t get it to work properly, could be putting it in the wrong place

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

    Re: Modify Macro To Save In To Another Folder

    If you use SaveAs, you are changing the name of the active workbook. To go back to editing the original file you would have to close the wb and reopen the other copy.

    Using the SaveCopyAs method would give you a backup copy without changing the current active workbook name/location so you can keep working with no issue.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Modify Macro To Save In To Another Folder

    Hi JimmiOO

    This worked for me
    Please Login or Register  to view this content.
    John

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Modify Macro To Save In To Another Folder

    Hi JimmiOO

    I think JB's approach is the way to go. The revised macro I posted works fine the first time around in the same session but not the second time around in the same session.

    John

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Modify Macro To Save In To Another Folder

    Hi JimmiOO

    Using JB's recommendation, your code would look something like this
    Please Login or Register  to view this content.
    It's been tested.
    John

+ 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