Results 1 to 3 of 3

Thread: Adding an autosave option to my current macro

  1. #1

    Adding an autosave option to my current macro



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi there. I have a spreadsheet which is available to all staff at my office on which we log issues. It's a fairly simple form and through help from the good people here, I have managed to add buttons to push the data onto a second hidden worksheet, to avoid any accidental errors, and also another button to clear the data from the first form.
    The issue I'm having is that people appear to be forgetting to save the spreadsheet when they close it and we are therefore losing their updates. I have found a macro (I think that's the right term) online which professes to autosave the excel worksheet when it is closed, but for the life of me I cannot get it to work. Could anyone please tell me if there is something wrong with it and if not, where I should put it to ensure that we have an autosave on closing. The 'macro' is below

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Save
    End Sub
    Thanks in advance.

  2. #2
    Conjurer royUK's Avatar
    Join Date
    Mar 2011
    Location
    Derbyshire, UK
    Posts
    155
    Articles
    0
    Excel Version
    most versions
    It depends where you have placed it.

    Personally I would just add

    Code:
    ThisWorkBook.Save
    to the end of your existing code
    Hope that helps

    Roy

  3. #3
    That works a treat, thank-you so much for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •