View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Need help re VBA for Worksheet Open Event

If the passwords are all the same:

Private Sub Workbook_Open()
Application.ScreenUpdating = False

Dim WS As Worksheet
dim myPWD as string

myPwd = "hithere"

With Application
.Calculation = xlManual
.MaxChange = 0.001
.CalculateBeforeSave = False
End With

For Each WS In Worksheets
WS.Protect password:="hithere", _
contents:=True, userInterfaceOnly:=True
WS.EnableAutoFilter = True
Next WS
End Sub

LucyRB wrote:

Try specifying the password in your .protect line.


Thanks for your reply, David. I'm not sure how to do this (ie. VBA code) or
if this would produce the desired result: for the"Unprotect Sheet" password
prompt (with OK or Cancel as only options) to *not* appear when the users
open the workbook containing password-protected worksheets.

I may be misunderstanding the effect of putting the password in the .protect
line, however.


--

Dave Peterson