Disable Save unless a Macro is used

L

LB79

Ive looked through the posts but i cant seem to make this work. I have
workbook that automatically updates from another and then saves itself
The trouble is I dont want the people using the workbook to be able t
save it. As far as the user is concerned, when they press Save o
SaveAs nothing happens OR they recieve a message to tell them it won
save. When the update from another workbook is recieved I want th
Macro to be able to enable save, save the workbook, the disabl
save/SaveAs.

Please can someone help me?
 
F

Frank Kabel

Hi
you can put the following code in your workbook module

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
msgbox "Can't save"
cancel=true
End Sub

And in your saving macro put something like

'....
application.enableevents=false
activeworkbook.save
application.enableevents=true
'....


Note. this will only work if macros are enabled!
 
L

LB79

I cant get the first part of the script to work. I pasted it to th
module and the top part (above MSGBOX) is in red and save still works
Am i pasting it in correctly
 
F

Frank Kabel

Hi
the first two lines are actually only ONE line (wordwrap caused by the
newsreader)
 
Top