PC Review


Reply
Thread Tools Rate Thread

diasable "save as"

 
 
Will Sellers
Guest
Posts: n/a
 
      2nd Jun 2007
I setup a vb that disables the save as on the file menu.
the code works as expected. But only if I click on run in the VB editor.
In general I have
sub
command saveas enable=false (not exact syntax )
end sub

How do I get this to execute when I open the workbook?
When I close the workbook I want to reverse the code so that the next
workbookthat is opened does not have saveas greyed.

I have the code, but where to put it, so that it executes, is my problem.


 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      2nd Jun 2007
>I setup a vb that disables the save as on the file menu.
> the code works as expected. But only if I click on run in the VB editor.
> In general I have
> sub
> command saveas enable=false (not exact syntax )
> end sub
>
> How do I get this to execute when I open the workbook?
> When I close the workbook I want to reverse the code so that the next
> workbookthat is opened does not have saveas greyed.
>
> I have the code, but where to put it, so that it executes, is my problem.


I'm not sure about this, but in the VB editor, double-click the ThisWorkbook
item in the VBA Project Explorer tree (hit Ctrl+R if it is not showing) and
select Workbook from the left-hand drop down on the code editing window that
appears. In the right-hand drop down, select the Open event. Put your call
to you subroutine there. Now, save the project and close the workbook. Now,
when you reopen it, I THINK the SaveAs option will be disabled.

Rick

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      2nd Jun 2007

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Worksheet Menu
Bar").Controls("File").Controls("Save As...").Enabled = True
End Sub

Private Sub Workbook_Open()
Application.CommandBars("Worksheet Menu
Bar").Controls("File").Controls("Save As...").Enabled = False
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Will Sellers" <(E-Mail Removed)> wrote in message
news:X3h8i.1477$WE4.397@trndny01...
>I setup a vb that disables the save as on the file menu.
> the code works as expected. But only if I click on run in the VB editor.
> In general I have
> sub
> command saveas enable=false (not exact syntax )
> end sub
>
> How do I get this to execute when I open the workbook?
> When I close the workbook I want to reverse the code so that the next
> workbookthat is opened does not have saveas greyed.
>
> I have the code, but where to put it, so that it executes, is my problem.
>
>



 
Reply With Quote
 
Bernie Deitrick
Guest
Posts: n/a
 
      2nd Jun 2007
Will,

Better would be to use the before save event. Put this into the codemodule
of the ThisWorkbook object:

Private Sub Workbook_BeforeSave( _
ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI Then
Msgbox "Sorry, you can only save me with my original name and path."
Cancel = True
End If
End Sub

HTH,
Bernie
MS Excel MVP

"Will Sellers" <(E-Mail Removed)> wrote in message
news:X3h8i.1477$WE4.397@trndny01...
>I setup a vb that disables the save as on the file menu.
> the code works as expected. But only if I click on run in the VB editor.
> In general I have
> sub
> command saveas enable=false (not exact syntax )
> end sub
>
> How do I get this to execute when I open the workbook?
> When I close the workbook I want to reverse the code so that the next
> workbookthat is opened does not have saveas greyed.
>
> I have the code, but where to put it, so that it executes, is my problem.
>
>



 
Reply With Quote
 
Bob Flanagan
Guest
Posts: n/a
 
      3rd Jun 2007
If the user disables macros when they open the workbook, they can do
whatever they want.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Will Sellers" <(E-Mail Removed)> wrote in message
news:X3h8i.1477$WE4.397@trndny01...
>I setup a vb that disables the save as on the file menu.
> the code works as expected. But only if I click on run in the VB editor.
> In general I have
> sub
> command saveas enable=false (not exact syntax )
> end sub
>
> How do I get this to execute when I open the workbook?
> When I close the workbook I want to reverse the code so that the next
> workbookthat is opened does not have saveas greyed.
>
> I have the code, but where to put it, so that it executes, is my problem.
>
>



 
Reply With Quote
 
Will Sellers
Guest
Posts: n/a
 
      3rd Jun 2007
Thanks guys

Your pointers worked like a charm

"Will Sellers" <(E-Mail Removed)> wrote in message
news:X3h8i.1477$WE4.397@trndny01...
>I setup a vb that disables the save as on the file menu.
> the code works as expected. But only if I click on run in the VB editor.
> In general I have
> sub
> command saveas enable=false (not exact syntax )
> end sub
>
> How do I get this to execute when I open the workbook?
> When I close the workbook I want to reverse the code so that the next
> workbookthat is opened does not have saveas greyed.
>
> I have the code, but where to put it, so that it executes, is my problem.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display "Authors" below "save as type" in the "save" windo. Clark Microsoft Word Document Management 1 19th Aug 2009 01:48 PM
"Open", "Save" or "Save As" dialog box default settings krazykat Windows XP Help 8 4th Sep 2008 10:11 AM
How do I save "details" View + "Date Modified" in "insert file" Kevin Clough Microsoft Outlook Discussion 1 16th Jun 2008 10:59 PM
Word shows "save" and "save" in drop down menu- no "save as" =?Utf-8?B?SmVubmlmZXJL?= Microsoft Word Document Management 4 26th May 2006 06:21 PM
File Menu options greyd out - "New", "Open", "Save As" =?Utf-8?B?QnJ1Y2U=?= Microsoft Word Document Management 1 13th Oct 2004 03:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:06 AM.