Professional Documents
Culture Documents
O primeiro modo atravs de macro. Voc precisa entender um pouco de macro ou pelo
menos ler este post, onde explico como criar uma macro simples.
Na verdade voc precisar apenas pressionar Alt + F11 para abrir o Visual Basic, que
quem gerencia as macros do Excel. Em seguida voc ir clicar duas vezes no item que
tem fundo azul na imagem abaixo:: (Esta_pasta_de_trabalho):
<img
class="aligncenter
size-full
wp-image-1642"
src="http://www.feranoexcel.com/wp-content/uploads/Esta-pasta-de-trabalho.jpg" alt="Esta
pasta de trabalho" width="182" height="178" />
Ao fazer isto, ser aberto do lado direito um painel. Voc ir ento copiar e colar o cdigo
abaixo:
Sub DesprotegerPlanilhaAtiva()
Dim i, i1, i2, i3, i4, i5, i6 As Integer, j As Integer, k As Integer, l As Integer , m As
Integer, n As Integer
On Error Resume Next
For i = 65 To 66
For j = 65 To 66
For k = 65 To 66
For l = 65 To 66
For m = 65 To 66
For i1 = 65 To 66
For i2 = 65 To 66
For i3 = 65 To 66
For i4 = 65 To 66
For i5 = 65 To 66
For i6 = 65 To 66
For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & Chr(l) & Chr(m) & Chr (i1) & Chr(i2)
& Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox Planilha desprotegida com sucesso!!!
Exit Sub
End If
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
End Sub
Aps colar o cdigo ele ficar mais ou menos assim:
<img
class="aligncenter
size-full wp-image-1644" src="http://www.feranoexcel.com/wp-content/uploads/excutarmacro-para-desproteger-planilha.jpg" alt="executar macro para desproteger planilha"
width="390" height="371" />
Clique sobre o boto Executar e aguarde alguns segundos. Se tudo deu certo, voc ver a
mensagem abaixo:
<img class="aligncenter
size-full wp-image-2053" src="http://www.feranoexcel.com/wp-content/uploads/erro-codigo-
Nenhum
CODIGO
'
' Syntax
'
' DisplayStatus(PasswordsTried)
'
Application.StatusBar = LastStatus
DoEvents
End If
End Sub
' Try unlocking the sheet with all passwords of the specified size.
'
'
'
'
'
For Index = 65 To 66
TrySheetPasswordSize = True
Exit Function
End If
Next Index
TrySheetPasswordSize = True
Exit Function
End If
PasswordsTried = PasswordsTried + 1
Next Index
End If
On Error GoTo 0
DisplayStatus PasswordsTried
End Function
' Try unlocking the workbook with all passwords of the specified size.
'
'
'
'
'
For Index = 65 To 66
TryWorkbookPasswordSize = True
Exit Function
End If
Next Index
TryWorkbookPasswordSize = True
Exit Function
End If
PasswordsTried = PasswordsTried + 1
Next Index
End If
On Error GoTo 0
DisplayStatus PasswordsTried
End Function
' Unlock the active sheet using a backdoor Excel provides where an
alternate
PasswordsTried = 0
Exit Sub
End If
ActiveSheet.Protect ""
ActiveSheet.Unprotect ""
On Error GoTo 0
If ActiveSheet.ProtectContents Then
Next PasswordSize
End If
MsgBox "The sheet " & ActiveSheet.Name & " has been unprotected with
password '" & Password & "'."
End If
Application.StatusBar = False
End Sub
' Unlock the active workbook using a backdoor Excel provides where an
alternate
PasswordsTried = 0
Exit Sub
End If
ActiveWorkbook.Unprotect vbNullString
On Error GoTo 0
If ActiveWorkbook.ProtectStructure Or ActiveWorkbook.ProtectWindows
Then
Next PasswordSize
End If
MsgBox "The workbook " & ActiveWorkbook.Name & " has been
unprotected with password '" & Password & "'."
End If
Application.StatusBar = False
End Sub