+ Reply to Thread
Results 1 to 3 of 3

save without changes vba

  1. #1
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    372

    save without changes vba

    I know this has been asked before, but i cant find an answer for the problem.

    I have a spreadsheet that multiple users use and i want to display 1 worksheet that asks the user to "enable the macro". when they do, that page hides and 3 others are shown. This part works ok
    when they save the spreadsheet, it saves as normal.

    what i want to do is when the user closes the spreadsheet is to rehide the 3 opened worksheets and unhides the original worksheet that asks to "enable the macro". this works fine also when the user presses save when closing. however if they dont want to save when closing, then the worksheet states doesnt change to my desired states and so when the next person opens the sheet, they are not prompted to "enable the macro" due to the 3 worksheets are open and not the single sheet.

    i use this vba for the close
    Please Login or Register  to view this content.
    and use this vba for the exit
    Please Login or Register  to view this content.
    if they chose yes, save my changes when they close it all works good, but if they choose No then im a little screwed.


    is there a vba that if they choose no to the changes that removes all the changes they did make (since last save) and save it anyway?

  2. #2
    Forum Expert ByteMarks's Avatar
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,176

    Re: save without changes vba

    is there a vba that if they choose no to the changes that removes all the changes they did make (since last save) and save it anyway?
    To me, that sounds tricky especially as the undo stack is reset when using macros.

    An alternative could be to protect the "main" file so that it needs a password to open it. Then use another "opener" file which opens the "main" file with the password and closes itself.
    That way the "main" file can't be opened unless it's via the "opener" file, which needs macros enabled.

  3. #3
    Forum Contributor
    Join Date
    01-25-2025
    Location
    Presov, Slovakia
    MS-Off Ver
    2021
    Posts
    291

    Re: save without changes vba

    Hi,
    you can do it with a macro.
    But there is a risk that "someone" will save the file in "Design Mode", or in "error" state.
    It is up to you to weigh the risks.

    Principle with internal macro:
    before each saving, all sheets except "Landing Page" are hidden.
    After saving, the sheets return to their original state.
    m.s.
    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. Replies: 1
    Last Post: 04-18-2023, 05:06 AM
  2. Save/Save As Disable Request Password to Save
    By omrustnr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-31-2023, 01:42 AM
  3. [SOLVED] Password to allow save and save as options for the WB using change events (before save)
    By Lona in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-02-2022, 06:44 AM
  4. Replies: 1
    Last Post: 04-29-2016, 11:55 AM
  5. Disable Save As and Save - enable Save via button
    By LampCommandr in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-07-2011, 05:42 PM
  6. [SOLVED] How to diasble save and save as menu but allow a save button
    By hon123456 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2006, 04:55 AM

Tags for this Thread

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