View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Paul B[_6_] Paul B[_6_] is offline
external usenet poster
 
Posts: 135
Default Question about Protecting a Workbook

you could use something like this to ask for a password before the workbook
is saved, but this can be defeated easily if someone knows much about excel

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
'must lock VBA project so you can't see the password in it
'Input box to verify password before saving
'put in this workbook module
Dim myPassword As String
myPassword = InputBox(prompt:="Please enter the password to proceed:", _
Title:="Password is required to save this file.")
'change password to what you want
If myPassword < "123" Then
MsgBox prompt:="Click OK to return to the workbook.", _
Title:="Correct password not entered", _
Buttons:=16
Cancel = True
Else
End If
End Sub

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
"TBA" wrote in message
...
Excel 2000
Windows 2k Pro

Is there a level of protection that I can set whereby a user can

edit/change
a workbook all they want EXCEPT that they can't save it?

TIA.

-gk-