Results 1 to 10 of 10

Disable Save As and Save - enable Save via button

Threaded View

  1. #1
    Registered User
    Join Date
    05-12-2010
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    42

    Disable Save As and Save - enable Save via button

    Hey folks,

    I have the following code in Workbook_BeforeSave, disabling all saving:

    Private Sub Workbook_BeforeSave(ByVal SaveUIAs As Boolean, Cancel As Boolean)
    
        Cancel = True
    
    End Sub
    I then have the following code in a module associated to a Save & Exit button, allowing the user to save and rename the file:

    Sub Save_Exit()
        
        Answer = MsgBox("This will save your current session and exit." & vbNewLine & vbNewLine & "Do you wish to continue?", vbOKCancel + vbInformation)
            If Answer = vbCancel Then Exit Sub
            
        Application.Dialogs(xlDialogSaveAs).Show
        Application.Quit
    
    End Sub
    I also have the following code allowing the user to save and overwrite the existing spreadsheet unless it is the template:

    Sub Save()
    
        If ThisWorkbook.Name = "Ad Schedule (Template).xlsm" Then
            Answer = MsgBox("Please rename this Template before saving your changes.", vbOKCancel + vbInformation)
                If Answer = vbCancel Then Exit Sub
            Application.Dialogs(xlDialogSaveAs).Show
        Else
            Answer = MsgBox("This will save your current session and overwrite the existing file." & vbNewLine & vbNewLine & "Do you wish to continue?", vbOKCancel + vbInformation)
                If Answer = vbCancel Then Exit Sub
            ThisWorkbook.Save
        End If
        
    End Sub

    I have a couple of questions:
    1. How do I re-enable saving for these two buttons?
    2. Is it possible to completely grey out the Save As and Save buttons?

    Thanks in advance!
    Last edited by LampCommandr; 04-07-2011 at 02:22 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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