View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
DowningDevelopments DowningDevelopments is offline
external usenet poster
 
Posts: 10
Default unprotecting my worksheet

Hello everyone,

I have a worksheet which works great except i wish to distribute it and so
want to protect it with a password. so far so easy but the next day when i
want to amend it and redistribute it i need to unprotect it again.

Dim strSharePwd as string

If ActiveSheet.Protect Then
'strSharePwd = InputBox("Enter password To protect")
ActiveSheet.Unprotect Password:=strSharePwd
Else
strSharePwd = InputBox("Enter password To protect")
ActiveSheet.Protect Password:=strSharePwd
End If


Ive got an ActiveXcontrol on the spreadsheet which should ask for the
password to be supplied either to protect or unprotect using the following
code but instead it only wishes to protect. My if statement doesnt seem to
funnel towards unprotecting.

Can anyone help?

With thanks,

Amit