+ Reply to Thread
Results 1 to 4 of 4

Save then save as before close

  1. #1
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    927

    Save then save as before close

    Hello

    Looking to do this steps before close the workbook

    1- save
    2 - save as in desktop (overwrite if exsist)
    3 - close without alert

    so it will generate backup of the file in my desktop everytime I close the file

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hello, try this ...


    The ThisWorkbook event VBA procedure for starters :

    PHP Code: 
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
        
    Save
        SaveCopyAs Replace
    (FullNamePathCreateObject("WScript.Shell").SpecialFolders("Desktop"))
    End Sub 
    ► Do you like it ? ► So thanks to click on bottom left star icon « Add Reputation » !

  3. #3
    Forum Contributor
    Join Date
    07-14-2019
    Location
    Dubai
    MS-Off Ver
    2019
    Posts
    927

    Re: Save then save as before close

    sometimes there is alert that there file with same name in desktop, there any code to avoid the alret and always overwrite?

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Save then save as before close


    So weird as not on my side …
    Anyway you can set Application.DisplayAlerts to False before SaveCopyAs and set it to True after …

+ 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] Close and Save after inactivity, workbook keep re-opening, save and close, re-open... etc
    By QcHuldar in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2020, 02:51 PM
  2. Save the current worrkbook, save the sheet as .csv and close the workbook
    By SpeediWeb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2015, 06:50 AM
  3. Macro to Save current XLS, then to save as a CSV. Then close CSV and reopen XLS
    By cricker in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-02-2014, 06:17 AM
  4. Save As but keep active wb open but the Save As .close
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2014, 01:45 PM
  5. Close ALL Workbooks and Save Changes WITHOUT asking do I want to save.
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-19-2013, 11:46 AM
  6. Replies: 1
    Last Post: 10-25-2013, 06:10 PM
  7. Code, that disables save, save as and close commands
    By mgmetev in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2009, 06:31 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