+ Reply to Thread
Results 1 to 4 of 4

Disable SAVE, SAVE AS & CTRL+S once Macro is executed

  1. #1
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Colombo, Sri Lanka
    MS-Off Ver
    2010
    Posts
    129

    Disable SAVE, SAVE AS & CTRL+S once Macro is executed

    hello friends,

    I got this workbook comprising of about 30 sheets. all sheets run macros and all sheets are locked except for some cells in each sheet where data entry is required in order to get the out put.

    about 4 sheets got BUTTONS (created using format control).

    my requirement is to disable the SAVE, SAVE AS & CTRL+S functions once either of these buttons are pressed.

    for this purpose, could a textbox appear with a sign "THIS FILE CANNOT BE SAVED - PRESS OK TO EXIT". so once OK is pressed the file exits without saving.

    this textbox should appear in all 30 sheets, whilst this textbox is on we should be able to work on other sheets as well. but the bottom line is that the workbook cannot be saved and this too only if either one of the 4 BUTTONS are pressed.

    the 4 BUTTONS are assigned to different macros.

    looking forward to your assistance.

    thank you
    regards
    rizvi

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Disable SAVE, SAVE AS & CTRL+S once Macro is executed

    Parts of your description are confusing. You talk about a textbook but then talk about clicking OK. Where is the OK that they are going to press?
    this textbox should appear in all 30 sheets, whilst this textbox is on we should be able to work on other sheets as well.
    If the user attempts to save, this textbox is generated in all 30 sheets? I think your best bet there is to create these textboxes in each sheet but make them invisible. Then the code can just make them visible. I recommend using a Textbox control instead of a textbox shape so it can be more reliably addressed in code.

    Here is the basic idea but I suggest you see if you can adapt this. Instead of generating textboxes in all the sheets this code just shows a message box.

    Put the following code into the ThisWorkbook module:
    Please Login or Register  to view this content.
    And in each existing button handler:
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Colombo, Sri Lanka
    MS-Off Ver
    2010
    Posts
    129

    Re: Disable SAVE, SAVE AS & CTRL+S once Macro is executed

    Hi 6StringJazzer,

    Thanks Mate. YES! it's the MsgBox, of course!
    Now, instead of BUTTONS, i could create MsgBoxes (1 per each sheet of 4 sheets as explained in my initial msg). so in all 4 sheets the MsgBox will initially read "PRESS TO PROCESS LETTERS" with OK button

    so in case say SHEET3 i press the OK button the process is done and another msg in the same MsgBox should appear as "THIS FILE CANNOT BE SAVED - PRESS OK TO EXIT" and with another OK button to also appear in the same MsgBox. if OK is pressed, then the file es exited without saving.

    say SHEET 6 also got a MsgBox, and i want the same process to happen in this sheet as well. likewise all 4 sheets should have this MsgBox as each sheet has different functions with the MsgBox but once OK is pressed all 4 MsgBoxes got the same function.

    plsd to hear
    thanks / rizvi

  4. #4
    Forum Contributor
    Join Date
    05-04-2015
    Location
    Colombo, Sri Lanka
    MS-Off Ver
    2010
    Posts
    129

    Re: Disable SAVE, SAVE AS & CTRL+S once Macro is executed

    Hi Mate,

    I have taken the time now to work on your suggested macros and the magic happened! it worked!!!
    many thanks for your help and i have given you a rep whilst also closing this thread as solved.

    all the best to you.
    Rizvi

+ 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] Disable Save / Save As except through macro
    By billfinnjr in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2019, 12:07 PM
  2. How can I disable Save and Save As in Excel 2007
    By anilgsudhan in forum Excel General
    Replies: 2
    Last Post: 04-24-2013, 08:19 AM
  3. Macro to disable SAVE and SAVE AS
    By Charmymay in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-04-2013, 10:06 AM
  4. Disable save and save as upon opening a certain workbook
    By Tino XXL in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2011, 01:49 PM
  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. disable save and saveas but have submit button to save file as work
    By briant97 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-04-2010, 12:32 PM
  7. Remove or Disable the Save Function and Keep the Save As
    By topkick in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-23-2005, 08:38 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