+ Reply to Thread
Results 1 to 2 of 2

Disable save icon

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    351

    Disable save icon

    How do I disable the save icon in a workbook? I've tried this:
    Sub DisableSaveButton
    Application.CommandBars("Standard").FindControl(ID:=3).Enabled = False
    End Sub
    and assigned it to a button but to no avail. Any suggestions?

  2. #2
    Forum Contributor
    Join Date
    07-26-2012
    Location
    USA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    351

    Re: Disable save icon

    BETTER SOLUTION:

    define a boolean variable, set to false on workbook open
    on BeforeSave event, check if boolean is false, if so cancel save, exit procedure and tell user they must use a custom button to save the file

    SaveFormButtonClicked as Boolean
    Private Sub Workbook_Open()
    SaveFormButtonClicked = False
    End Sub
    Sub SaveFormAsXLSX
    
    ThisWorkbook.SaveFormButtonClicked = True
    'save commands
    ThisWorkbook.SaveFormButtonClicked = False
    End Sub
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    
    If SaveFormButtonClicked = False Then
        MsgBox "The save button you just clicked is disabled. Please use the 'Save Form' button on the right of the spreadsheet.", vbInformation, "Standard Saving Is Disabled"
        Cancel = True
        Exit Sub
    End If
    From my testing so far, going this route will disable the Save icon on ribbon, the Save menu item, the Save As menu item, and the Save keyboard shortcut.

    ...ok, so it doesn't actually disable these items, it prevents the user from being able to use them to save the file...basically forces them to use a control button you've placed on the sheet.

    Still curious as to why the code in my OP doesn't work though

+ 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. Disable toolbar print icon?
    By Margate in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-09-2013, 02:09 PM
  2. Disable Macro Icon in menu bar
    By vijay2482 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-09-2009, 10:36 AM
  3. disable macro icon
    By vijay2482 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-06-2009, 10:57 AM
  4. [SOLVED] Disable print icon in toolbar??
    By StargateFanFromWork in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-08-2006, 02:40 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