throtmorton
Board Regular
- Joined
- Aug 9, 2005
- Messages
- 94
- Office Version
- 365
- Platform
- Windows
Hi,
My old XP hard drive died, so I got a new one. Installed Excel 2003, and my file works fine. However, this routine not only doesn't work, but crashes Excel. It worked fine before, and still works find on my Vista machine.
Very much appreciate any help!
Thanks,
Paul
Here's the error message:
Run-time error '1004':
Method 'Protect' of object'_Worksheet' failed
******
Option Explicit
Public Const strPassWord = "y"
******
Sub Protect()
Application.ScreenUpdating = False
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Protect Password:=strPassWord
Application.ScreenUpdating = True
Next wSheet
Application.ScreenUpdating = True
End Sub
My old XP hard drive died, so I got a new one. Installed Excel 2003, and my file works fine. However, this routine not only doesn't work, but crashes Excel. It worked fine before, and still works find on my Vista machine.
Very much appreciate any help!
Thanks,
Paul
Here's the error message:
Run-time error '1004':
Method 'Protect' of object'_Worksheet' failed
******
Option Explicit
Public Const strPassWord = "y"
******
Sub Protect()
Application.ScreenUpdating = False
Dim wSheet As Worksheet
For Each wSheet In Worksheets
wSheet.Protect Password:=strPassWord
Application.ScreenUpdating = True
Next wSheet
Application.ScreenUpdating = True
End Sub