Code to disable Save options

K

Keith Emery

I am using this code to turn off all save options when a
spread sheet opens. (Stupid end users keep saving in the
wrong places)
**********************************************************
Sub EnableSave(Enable As Boolean)
Dim myCmd As Object
Set myCmd = CommandBars("Worksheet menu
bar").Controls("File")
myCmd.Controls("Save").Enabled = Enable

Set myCmd = CommandBars("Worksheet menu
bar").Controls("File")
myCmd.Controls("Save As...").Enabled = Enable

Set myCmd = CommandBars("Standard")
myCmd.Controls("&Save").Enabled = Enable
End Sub
********************************************************

However, it would be better if this only affected the
workbook, nott the instance of Excel as sometimes the
sheet is left open in the background.

Is there a way of disabling save for specific workbooks?
 
K

keepITcool

I'm no fan of fumbling with the important toolbars..

Put this in your workbook's thisworkbook codemodule:


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

<grin> NOW let m be stupid!



keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 
C

Chris.F

Instead of limiting where they can save, have you thought of giving them a
'SAVE' button and assigning a macro to save it to the right place?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top