+ Reply to Thread
Results 1 to 9 of 9

VBA Code to SaveAs file in one location, and backup to another location

  1. #1
    Registered User
    Join Date
    12-07-2013
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    91

    VBA Code to SaveAs file in one location, and backup to another location

    Hello,

    I have a code where when user selects SaveAs, it will automatically direct the user to the intended path and intended filename populated in saveas dialog box.

    How do I save a copy to another location using the same function? So it will have 2 copies living in 2 separate directories?

    I am assuming i have to run SaveAs and Save simultaneously but cant figure this out to save my life so some help would be greatly appreciated.


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: VBA Code to SaveAs file in one location, and backup to another location

    Will the workbook name change?

    either way you can save AS to the backup location THEN save as to the location they choose for you.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: VBA Code to SaveAs file in one location, and backup to another location

    ActiveWorkbook.SaveCopyAs Filename:= filePath & ActiveWorkbook.Name assuming filePath is the file path you want to use.

  4. #4
    Registered User
    Join Date
    12-07-2013
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    91

    Re: VBA Code to SaveAs file in one location, and backup to another location

    Thanks for ur reply. The filename stays the same....so where would i put the code you suggested? As another private sub function? Or does it go in current private sub.

  5. #5
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: VBA Code to SaveAs file in one location, and backup to another location

    So there are a few constraints apparently. It can only be saved as an xlsx file so this won't work for you BUT try the following shown in blue.

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    12-07-2013
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    91

    Re: VBA Code to SaveAs file in one location, and backup to another location

    Great! Thanks for ur help. I will try this as soon as i get home in a few

  7. #7
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: VBA Code to SaveAs file in one location, and backup to another location

    Sure, let me know because I just wrote it out and didnt test it myself or anything

  8. #8
    Registered User
    Join Date
    12-07-2013
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    91

    Re: VBA Code to SaveAs file in one location, and backup to another location

    Thank you so much Mike, you guys are great.

    It wasnt working as intended at first because the SaveAs box came up twice, but i wiggled the code a bit to say SaveCopyAs and its working as intended. I really appreciate your help leading me on right path!

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-07-2013
    Location
    NJ
    MS-Off Ver
    2010
    Posts
    91

    Re: VBA Code to SaveAs file in one location, and backup to another location

    well, i spoke too soon. This indeed works, it works because the first time, when user selects SaveAs it will save and make a copy. However, when the user opens the file again and user would select 'save', it will save the original file but it will not save over the copy in back-up folder.....what am i missing? Do i need to trigger something for Save?

    Please Login or Register  to view this content.

+ 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] Specify export pdf file location is location workbook is saved.
    By dantray02 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-30-2014, 01:13 PM
  2. Code that works in one location but not another location. (AdvancedFilter excel function)
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2013, 02:18 PM
  3. [SOLVED] [Help]macro to open file browser, to select a location, and save the location to a cell
    By zhuleijia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2013, 09:56 AM
  4. 2007 Excel auto backup file in different location
    By Shakeelqamar in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 01-01-2013, 07:16 PM
  5. Replies: 1
    Last Post: 10-31-2012, 11:19 AM

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