Results 1 to 2 of 2

Thread: Disable Save and Save as in Excel 07

  1. #1
    Join Date
    Jun 2011
    Posts
    1

    Disable Save and Save as in Excel 07

    I have entered several codes and cannot get this to work.
    What I need to do is, write a code that will permanantly disable Save and Save As (from menu, shortcuts, etc) on this one workbook. The workbook consists of several formulas that my associates need to be able enter data and tally the answers yet, not be allowed to save anything they edit. This one workbook is used alot and by several people.

    What i have done so far is enter this code(one of many that ive tried, yet this was the only one that remotely did anything)

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    ' Following line will prevent all saving
    Cancel = True
    ' Following line will prevent the Save As Dialog box from showing
    If SaveAsUI Then SaveAsUI = False
    End Sub

    So this code worked until i exited out of the workbook and went back in. I made a change and clicked save and it saved.

    How can i disable these to do what i need them to do?

  2. #2
    Join Date
    Jan 2006
    Posts
    605

    Re: Disable Save and Save as in Excel 07

    This was written in ExcelXP, but you should get an idea of what you need to do. Each control has a number assigned to it, and you would need to know that number to disable it.
    Code:
    Sub DisableMenuItems()
    
    With CommandBars("File")
    
                .Controls(4).Enabled = False 'Save Button
                .Controls(5).Enabled = False 'Save As Button
                .Controls(15).Enabled = False 'Print Button
    End With
            
    
    End Sub

Similar Threads

  1. Replies: 3
    Last Post: 04-03-2012, 01:53 AM
  2. How to disable save a copy function in Excel
    By kelbel7795 in forum Windows Software
    Replies: 2
    Last Post: 18-07-2011, 09:17 PM
  3. Replies: 2
    Last Post: 03-05-2011, 05:05 PM
  4. Replies: 1
    Last Post: 19-10-2010, 08:36 AM
  5. Replies: 0
    Last Post: 09-02-2009, 07:36 PM

Tags for this Thread

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
  •  
Page generated in 1,713,866,637.62285 seconds with 17 queries