Question

  Asked: Apr 7 2008   10:21 AM GMT
  Asked by: Georgesal001


VBA Auto Protect


VBA, Excel 2003, Visual Basic for Applications

How can I make the worksheets in Excel automaticaly protected on date

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Unless you are running Excel 24/7, the only way is to open the workbook whose worksheets you want to protect and then run this macro:

Sub ProtectMe()
Dim ws As Excel.Worksheet

For Each ws In Worksheets
ws.Protect Password:="password1"
Next ws

End Sub


Of course you would substitute your real password for "password1".


HTH,
JP
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development and Microsoft Windows.

Looking for relevant Development Whitepapers? Visit the SearchSQLServer.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register