Private Sub workbook_beforesave(ByVal SaveAsUI As Boolean, cancel As Boolean) MsgBox ("Sorry you cannot save this workbook using this method") SaveAsUI = False cancel = True End Sub
You have to put the code into the Workbook module (not a normal module).
UI = User Input
Celia
i stiil don't u/stand..where can i find it..could u help me more celia.thanks
Re: i stiil don't u/stand..where can i find it..could u help me more celia.thanks
Open your workbook.
Open the VB editor by pressing ALT + F11.
Select View/Project Explorer.
You will see your workbook name in the Project list.
Under your workbook name you will see ThisWorkBook
Double click on ThisWorkBook.
The workbook code module will open.
Put the code in the module.
Celia
thanks celia..will do it...n try it..thanks 4 the concerned..bye...
Re: the save my work book will not save it.
I have put the code in the Workbook.
and It works great but, how do I save it in there as I must close the workbook. And it doesn't save the changes.
So the next time the template is opened. People can copy it again.
What am I not doing? Any ideas.
Re: the save my work book will not save it.
and It works great but, how do I save it in there as I must close the workbook. And it doesn't save the changes. So the next time the template is opened. People can copy it again. What am I not doing? Any ideas.
If you are giving this workbook to other users
on there machines AND they don't have the same
Username as you then try this;
Private Sub workbook_beforesave(ByVal SaveAsUI As Boolean, cancel As Boolean)
if Application.Username <> "Your username goes here" then
MsgBox ("Sorry you cannot save this workbook using this method")
SaveAsUI = False
cancel = True
endif
End Sub
Ivan