dcsimg
Results 1 to 2 of 2

Thread: Disable SaveAs on Workbook Close

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2009
    Posts
    18

    Disable SaveAs on Workbook Close

    --------------------------------------------------------------------------------

    I am working on a macro that will disable all save/saveas menu options and shortcuts, I also have the saveas dialogue disabled when excel is closed, however I cannot for the life of me figure out how to disable to saveas dialogue box when the workbook is closed! Also, I seem to be running into trouble with another macro that I wrote that overwrites my code and allowes the user to save with a password. Here is my code... any ideas?


    Code:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Cancel = True
    If SaveAsUI Then SaveAsUI = False
    End Sub
    Sub Workbook_Open()
    Application.CommandBars("Standard").Controls(3).Enabled = False
    Application.CommandBars("File").Controls(5).Enabled = False
    Application.CommandBars("File").Controls(4).Enabled = False
    Application.OnKey "^s", ""
    Application.OnKey "^S", ""
    Application.OnKey "{F12}", ""
    Application.OnKey "%{F11}", ""
    Application.OnKey "^A", "UnlockSave"
    Application.DisplayAlerts = False
    Call AddBISTools

    End Sub
    Sub Workbook_BeforeClose(Cancel As Boolean)
    ActiveWorkbook.Saved = True
    Call DeleteBISTools
    End Subthe unlocksave() function calls a userform with a text field, an OK button and a Cancel button, when OK is hit, it prompts the save as dialogue box, but will not actually save the file... any ideas on how to overcome this problem? I think the two might be related.

  2. #2
    Super Moderator Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    11,998

    Re: Disable SaveAs on Workbook Close

    however I cannot for the life of me figure out how to disable to saveas dialogue box when the workbook is closed!

    Sub Workbook_BeforeClose(Cancel As Boolean)
    ActiveWorkbook.Saved = True
    Call DeleteBISTools
    End Subthe
    change the above to

    Code:
    Sub Workbook_BeforeClose(Cancel As Boolean)
        Call DeleteBISTools
        ActiveWorkbook.Saved = True
    End Sub
    For the rest may I see your workbook for a faster resolution...
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved

    Microsoft MVP: 2011 - 2015 IMP Links : Acceptable Use Policy, FAQ
    MyGear:
    OMEN by HP - 15-ce073tx with Win10+Office 2013. || Mac Book Pro (10.6.8) with Office 2011

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width