View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Open Workbooks and Password Protect all Worksheets

Hi K

Here is a basic macro
http://www.rondebruin.nl/copy4.htm

Replace the red code block with something like this

On Error Resume Next
For Each sh In mybook.Worksheets
If sh.ProtectContents = False Then
With sh
.Protect = "REC"
End With
Else
ErrorYes = True
End If
Next sh



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"K" wrote in message ...
Hi all, I need macro which should open all excel workbooks one by one
in folder "C:\Document\Record\" and protect all worksheets in each
workbook with password "REC". I tried few my own experiments but I am
not getting any success. Please can any friend can help.