Prevent users to save workbook

T

Terence

Hi,

How to avoid users to save the workbook? I tried to
protect workbook and protect worksheet, but doesn't work.
Can anyone help?
Thanks a lot!

Terence
 
W

William

Terence

Place this code in the "ThisWorkbook" module

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

--
XL2002
Regards

William
(e-mail address removed)

| Hi,
|
| How to avoid users to save the workbook? I tried to
| protect workbook and protect worksheet, but doesn't work.
| Can anyone help?
| Thanks a lot!
|
| Terence
 
W

William

Hi Terence

Open your workbook and elect to disable macros. Place the code in the
workbook, save and then close the file. Reopen the file (enabling macros)
and all should be as you would want.

--
XL2002
Regards

William
(e-mail address removed)

| Hi,
|
| But how can I save the code? If I add the code you
| provided, I cannot save it to the file.
| Thanks.
|
| Terence
| >-----Original Message-----
| >Terence
| >
| >Place this code in the "ThisWorkbook" module
| >
| >Private Sub Workbook_BeforeSave(ByVal SaveAsUI As
| Boolean, Cancel As
| >Boolean)
| >Cancel = True
| >End Sub
| >
| >--
| >XL2002
| >Regards
| >
| >William
| >[email protected]
| >
| >| >| Hi,
| >|
| >| How to avoid users to save the workbook? I tried to
| >| protect workbook and protect worksheet, but doesn't
| work.
| >| Can anyone help?
| >| Thanks a lot!
| >|
| >| Terence
| >
| >
| >.
| >
 
T

Tim Otero

Terence,

You can save the code from the VBE, as long as the workbook has been saved
in the past. Only problem is, if the user does not enable macros, he can
still save it...

tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top