Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
menu / toobar item for open file by name nastech Excel Discussion (Misc queries) 2 July 14th 06 02:25 AM
in a excel file, how to make a menu item for the .xls file that when clicked on it runs myform.show? example plz Daniel Excel Worksheet Functions 1 July 7th 05 03:52 AM
Setting Onaction for File Save on Menu bar using item or index numbers David Cuthill Excel Programming 4 December 17th 04 12:44 PM
Disabling Menu Item Bill Excel Programming 0 November 24th 04 07:33 PM
Disable File-Save menu item in macro? BrianG[_4_] Excel Programming 1 February 25th 04 06:48 PM


All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"