Disabling 'File/Save' Menu Item

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to disable the File/Save menu item once a workbook is opened,
forcing a person to save the file under another name. I have code (see
below) to disable the File/Save As menu item, but cannot make one work for
disabling just File/Save. Can anyone assist with this?

Sub DisableSaveAsMenuItem()
With CommandBars("Worksheet Menu Bar")
With .Controls("File")
.Controls("Save As....").Enabled = False
End With
End With
End Sub
 
Paige said:
I would like to disable the File/Save menu item once a workbook is opened,
forcing a person to save the file under another name. I have code (see
below) to disable the File/Save As menu item, but cannot make one work for
disabling just File/Save. Can anyone assist with this?

Sub DisableSaveAsMenuItem()
With CommandBars("Worksheet Menu Bar")
With .Controls("File")
.Controls("Save As....").Enabled = False
End With
End With
End Sub

Try this:

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

It will prevent File|Save but not File|Save As. Is this hwat you want? You
say that you want to force tthe user to save under a different name. I don't
understand why your code tries to disable Save As.

/Fredrik
 
Why not just create the file as a template (.xlt) file at which point the
user can not save over the original and is forced to Save As. I see the
current method as being problematic. The Save feature would be gone for all
open spreadsheets. Not to mention you will need to get rid of Ctrl + S. If
the program crashes unexpectadly all is lost...

HTH
 
I like this solution, but this is going to require this workbook to be saved
as something different every time you want to save. (On the other hand that
is what Paige asked for). I have always liked your solutions so I was
wondering if you had a cool way around this... :)
 
Jim Thomlinson said:
I like this solution, but this is going to require this workbook to be saved
as something different every time you want to save. (On the other hand that
is what Paige asked for). I have always liked your solutions so I was
wondering if you had a cool way around this... :)

Thanks! Well, I guess Paige could create a hidden command with this code

Application.EnableEvents = False
ActiveWorkbook.Save
Application.EnableEvents = True

/Fredrik
 
Thanks, guys. I see what you are saying re being problematic...lots of good
suggestions on how to code or saving as a template. I'll work with these and
see what ends up working best for this particular worksheet. Appreciate your
quick responses - have a great day!!!.....Paige
 
PS to Fredrik - you said "You say that you want to force the user to save
under a different name. I don't understand why your code tries to disable
Save As."...that was just some code I found to disable SaveAs and was trying
to change it around to disable Save. You're right, I want to disable Save,
so your code was correct. Thanks again - Paige
 
Paige said:
PS to Fredrik - you said "You say that you want to force the user to save
under a different name. I don't understand why your code tries to disable
Save As."...that was just some code I found to disable SaveAs and was trying
to change it around to disable Save. You're right, I want to disable Save,
so your code was correct. Thanks again - Paige

Ahh... That's what I suspected. I'm glad I could help.

/Fredrik
 
Glad you could help also!!!! Thanks for sharing your wisdom and knowledge -
very much appreciated. Have a good one...
 
Back
Top