Consulting

Results 1 to 2 of 2

Thread: Using VBA to disable Save and Save As

  1. #1
    VBAX Newbie
    Joined
    Feb 2013
    Posts
    1
    Location

    Using VBA to disable Save and Save As

    Hi,
    I have spent the entire morning trying to cut and paste VBA code that I have found online to disable the "Save" and "Save As" funtion in an Excel 2007 - yes, I am a novice!!

    Can anyone take pity and write me a step by step process for this??? Or direct me to a previous posting?

    Any help greatly appreciated.

  2. #2
    VBAX Newbie
    Joined
    Jan 2013
    Posts
    4
    Location
    Hello sorry i tried to add a link but it did not let me so here is some codes i used. Following codes should go in ThisWorkbook Sheet

    The code below is if you like to have a password to save it.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
    Cancel As Boolean)
    Dim strA As String
    strA = InputBox("Enter password to save this file")
    If strA <> "Password" Then Cancel = True
    End Sub

    The code below is for not to be able to click on save or saveAs.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
    Cancel As Boolean)
    Cancel = True
    End Sub

    The code below will allow you to save the codes above.

    Private Sub Save
    Application.DisplayAlerts = False
    Application.EnableEvents = False
    ActiveWorkbook.Save
    Application.DisplayAlerts = True
    Application.EnableEvents = True
    end sub

    i hope this helps you.

Posting Permissions

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