I want to password protect a spreadsheet / sheets but need to be able to
unprotect them to manipulate them via a macro. Is this possible? The
password option does not appear to be available in the protect method. Cheers
I want to password protect a spreadsheet / sheets but need to be able to
unprotect them to manipulate them via a macro. Is this possible? The
password option does not appear to be available in the protect method. Cheers
Use the UserInterfaceOnly flag of the Protect method. This
prevents the user from modifying the sheet, but allows VBA to do
anything. This property is not saved with the workbook, so you
should protect the sheet(s) in the Workbook_Open event. E.g.,
Private Sub Workbook_Open()
Worksheets("Sheet1").Protect Password:="abc",
userinterfaceonly:=True
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Eithne R" <[email protected]> wrote in message
news:[email protected]...
>I want to password protect a spreadsheet / sheets but need to be
>able to
> unprotect them to manipulate them via a macro. Is this
> possible? The
> password option does not appear to be available in the protect
> method. Cheers
Yes it is available
ActiveSheet.Protect Password:="Ron"
ActiveSheet.Unprotect Password:="Ron"
--
Regards Ron de Bruin
http://www.rondebruin.nl
"Eithne R" <[email protected]> wrote in message news:[email protected]...
>I want to password protect a spreadsheet / sheets but need to be able to
> unprotect them to manipulate them via a macro. Is this possible? The
> password option does not appear to be available in the protect method. Cheers
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks