Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
"Paige" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
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 "Paige" wrote: 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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
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... :) "Fredrik Wahlgren" wrote: "Paige" wrote in message ... 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 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
"Jim Thomlinson" wrote in message ... 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 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
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 "Fredrik Wahlgren" wrote: "Jim Thomlinson" wrote in message ... 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 |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
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 "Fredrik Wahlgren" wrote: "Paige" wrote in message ... 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 |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
"Paige" wrote in message ... 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 |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disabling 'File/Save' Menu Item
Glad you could help also!!!! Thanks for sharing your wisdom and knowledge -
very much appreciated. Have a good one... "Fredrik Wahlgren" wrote: "Paige" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
menu / toobar item for open file by name | Excel Discussion (Misc queries) | |||
in a excel file, how to make a menu item for the .xls file that when clicked on it runs myform.show? example plz | Excel Worksheet Functions | |||
Setting Onaction for File Save on Menu bar using item or index numbers | Excel Programming | |||
Disabling Menu Item | Excel Programming | |||
Disable File-Save menu item in macro? | Excel Programming |