christianbiker
Active Member
- Joined
- Feb 3, 2006
- Messages
- 365
Greetings,
I have a spreadsheet that has been in use for some time and am now receiving an automation error for some reason. Here is the error:
Run-time error '-2147319767 (80028029)':
Automation error
Invalid forward reference, or reference to uncompiled type.
When I select the debug option, it takes me to this code and specifically highlights
All of the sheets are currently unlocked and I'm not sure why this error has all of a sudden started.
Any assistance would be greatly appreciated.
Thanks!
I have a spreadsheet that has been in use for some time and am now receiving an automation error for some reason. Here is the error:
Run-time error '-2147319767 (80028029)':
Automation error
Invalid forward reference, or reference to uncompiled type.
When I select the debug option, it takes me to this code and specifically highlights
VBA Code:
ws.Protect Password:=pwd1, DrawingObjects:=False, Contents:=True, Scenarios:=True, AllowFormattingCells:=True
VBA Code:
Sub protect_all_sheets()
Application.ScreenUpdating = False
Dim pwd1 As String, pwd2 As String
pwd1 = InputBox("Please Enter the password")
If pwd1 = "" Then Exit Sub
pwd2 = InputBox("Please re-enter the password")
If pwd2 = "" Then Exit Sub
'Check if both the passwords are identical
If InStr(1, pwd2, pwd1, 0) = 0 Or _
InStr(1, pwd1, pwd2, 0) = 0 Then
MsgBox "You entered different passwords. No action taken"
Exit Sub
End If
For Each ws In Worksheets
ws.Protect Password:=pwd1, DrawingObjects:=False, Contents:=True, Scenarios:=True, AllowFormattingCells:=True
Next
MsgBox "All sheets Protected."
Exit Sub
Application.ScreenUpdating = True
End Sub
All of the sheets are currently unlocked and I'm not sure why this error has all of a sudden started.
Any assistance would be greatly appreciated.
Thanks!