View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Thomlinson[_4_] Jim Thomlinson[_4_] is offline
external usenet poster
 
Posts: 1,119
Default Unprotect Sheet Password in Macros

public const MYPASSWORD as string = "supersecret" 'At the top of a module

Sub Stuff()
sheets("Sheet1").unprotect MYPASSWORD
'Do your stuff
sheets("Sheet1").protect MYPASSWORD
End Sub
--
HTH...

Jim Thomlinson


"Theresa" wrote:

Hi:

I have an Excel file that has been used as a template to create 800+ files
that has the protection worksheet applied. I now what to add more formulas
to this file and want to use a macro to do it. How can I enter the unprotect
password automaticcaly as part of the macro and then protect the sheet again
before saving and closing?

Thanks