Hello, I need to run a macro that is Private Sub Workbook_BeforeSave
but the worksheet points out that the project is protected and therefore does not run.
I wanted to know how I can call the password box, so I can unlock and lock quickly.
The code I'm trying to use:
Sub ProtectVBProject()
Dim wb As Workbook
Set wb = ActiveWorkbook
' Ativa a planilha a ser bloqueada
wb.Activate
' Envia o comando para abrir o VBA
SendKeys "%{F11}", True
' Abre a janela de proteção do projeto VBA
wb.VBProject.VBE.CommandBars(1).FindControl(ID:=761, recursive:=True).Execute ' Aqui eu precisaria do ID da caixa da senha
End Sub
If possible I would like a light. I tried searching the possible ID's, I did not find any compatible.