View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
David
 
Posts: n/a
Default Type Mismatch Error

When using the following code with Type 1, numbers, it works perfect. But
when I change the type to 2 (String) to use text as the password, I get a
mismatch error. Can anyone help?
Thanks!

Sub ProtectAllSheets()
'
Dim Password As String
Password = CLng(Application.InputBox(Prompt:="What Password Do You Want To
Use?", Type:=2))
If Password < 1 Then
'do nothing
Else
Worksheets(1).Activate
ActiveSheet.Protect (Password)
End If

End Sub