Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Disable Save/Save As - not working?

Hi Gord

I followed your steps and have the following code in VB but now when I use
"ctrl s" or F12 to test that Save/Save As doesn't work it, crashes Excel.
Any
ideas why? Silena

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ThisWorkbook.Saved = True
ThisWorkbook.Close

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
ThisWorkbook.Saved = True

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 533
Default Disable Save/Save As - not working?

In place of this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ThisWorkbook.Saved = True
ThisWorkbook.Close
End Sub

I think all you need is:

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

Leave the other sub as is. None of this will work if macros are not
enabled, so this is not hard to defeat.

--
Jim
"Silena K-K" wrote in message
...
| Hi Gord
|
| I followed your steps and have the following code in VB but now when I use
| "ctrl s" or F12 to test that Save/Save As doesn't work it, crashes Excel.
| Any
| ideas why? Silena
|
| Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
| ThisWorkbook.Saved = True
| ThisWorkbook.Close
|
| End Sub
|
| Private Sub Workbook_BeforeClose(Cancel As Boolean)
| ThisWorkbook.Saved = True
|
| End Sub
|


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 37
Default Disable Save/Save As - not working?

Thanks Jim for help on the 'save' issue.

I found your reply to disabling the copy command earlier this year ...

Sub DisableCopyCtrl()
Dim Ctrls As CommandBarControls
Dim Ctrl As CommandBarControl
Set Ctrls = CommandBars.FindControls(, 19)
For Each Ctrl In Ctrls
Ctrl.Enabled = False
Next
End Sub

....but haven't been able to get it to work. I pasted it into a general
module and saved it (not sure how to "enable" other than save??)

Can you help with this? Thanks Silena


"Jim Rech" wrote:

In place of this:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
ThisWorkbook.Saved = True
ThisWorkbook.Close
End Sub

I think all you need is:

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

Leave the other sub as is. None of this will work if macros are not
enabled, so this is not hard to defeat.

--
Jim
"Silena K-K" wrote in message
...
| Hi Gord
|
| I followed your steps and have the following code in VB but now when I use
| "ctrl s" or F12 to test that Save/Save As doesn't work it, crashes Excel.
| Any
| ideas why? Silena
|
| Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
| ThisWorkbook.Saved = True
| ThisWorkbook.Close
|
| End Sub
|
| Private Sub Workbook_BeforeClose(Cancel As Boolean)
| ThisWorkbook.Saved = True
|
| End Sub
|



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 533
Default Disable Save/Save As - not working?

Like all code it has to be run to do something<g.

Since a sub named Auto_Open will execute automatically when Excel opens a
workbook you can cause my sub to be run like this:

Sub Auto_Open()
DisableCopyCtrl
End Sub

This can go in the same standard module. Users can disable macros though.
If they do this code will not run.

--
Jim
"Silena K-K" wrote in message
...
| Thanks Jim for help on the 'save' issue.
|
| I found your reply to disabling the copy command earlier this year ...
|
| Sub DisableCopyCtrl()
| Dim Ctrls As CommandBarControls
| Dim Ctrl As CommandBarControl
| Set Ctrls = CommandBars.FindControls(, 19)
| For Each Ctrl In Ctrls
| Ctrl.Enabled = False
| Next
| End Sub
|
| ...but haven't been able to get it to work. I pasted it into a general
| module and saved it (not sure how to "enable" other than save??)
|
| Can you help with this? Thanks Silena
|
|
| "Jim Rech" wrote:
|
| In place of this:
|
| Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
| Boolean)
| ThisWorkbook.Saved = True
| ThisWorkbook.Close
| End Sub
|
| I think all you need is:
|
| Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
| Boolean)
| Cancel = True
| End Sub
|
| Leave the other sub as is. None of this will work if macros are not
| enabled, so this is not hard to defeat.
|
| --
| Jim
| "Silena K-K" wrote in message
| ...
| | Hi Gord
| |
| | I followed your steps and have the following code in VB but now when I
use
| | "ctrl s" or F12 to test that Save/Save As doesn't work it, crashes
Excel.
| | Any
| | ideas why? Silena
| |
| | Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
| Boolean)
| | ThisWorkbook.Saved = True
| | ThisWorkbook.Close
| |
| | End Sub
| |
| | Private Sub Workbook_BeforeClose(Cancel As Boolean)
| | ThisWorkbook.Saved = True
| |
| | End Sub
| |
|
|
|


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
Disable Quick Save & Save As L Weber Excel Discussion (Misc queries) 6 October 18th 07 08:57 PM
Disable save Jeff Excel Discussion (Misc queries) 2 October 3rd 07 02:31 PM
Disable save nobbyknownowt Setting up and Configuration of Excel 1 February 14th 07 08:18 PM
Disable save nobbyknownowt[_2_] Setting up and Configuration of Excel 0 February 13th 07 03:53 PM
Worksheet Buttons (Save, Save As, Cut, Paste, etc.) Not Working SuzieQ12345 Excel Worksheet Functions 5 January 21st 05 02:57 PM


All times are GMT +1. The time now is 12:54 PM.

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

About Us

"It's about Microsoft Excel"