View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default having trouble disabling "save", "save as" (2003)

If the user doesn't allow macros to run, then none of your macros will run.

You could password protect the workbook and then provide a helper workbook that
would open that workbook.
If macros are disabled for the helper workbook, then the real workbook won't
open.

If macros are enabled for the helper workbook, then the real workbook will have
macros enabled.



dman wrote:

How can I close my workbook, or prevent if from opening, if the user
selects disable marcos at startup?

"Dave Peterson" wrote in message
...
If you really want to disable all saves, you could try this workbook level
event:

Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Cancel = True
MsgBox "Cannot be saved!"
End Sub

If macros are disabled (or events are disabled), this will fail.

And remember that you have to disable events before you can update the
file,
too.

dman wrote:

Hi.

I have a workbook that I do not want the user to be able to save or save
as.
The code I have disables the proper icons, however, when I start Excel up
again
with a different workbook, the icons are still disabled.

If I remove the .application, I get object var or with block var not set.
How do I
disable the save/save as for only the workbook I need? Here is my code
int
he the
Workbook_Open sub.

ThisWorkbook.Application.CommandBars("Worksheet menu bar").Controls _
("&file").Controls("&Save").Enabled = False

ThisWorkbook.CommandBars("Worksheet menu bar").Controls _
("&file").Controls("&Save").Enabled = False

Help. Thanks.


--

Dave Peterson


--

Dave Peterson