Hi,
Do some coding mentioned below for resolving your issue.
Public Sub UnprotectVBAProject()
'This has been tested in E97 only.
On Error GoTo ErrHandler
Const conPW as String = "MyPassword"
'Open VBE
Call SendKeys("%{F11}", True)
'Open Project Explorer
Call SendKeys("%(V)P", True)
'PageUp 5 times to be sure "VBAProject" is selected
Call SendKeys("{PGUP 5}", True)
'Hit Enter to give prompt, enter PW and Enter again.
Call SendKeys("{ENTER}" & conPW & "{ENTER}", True)
ExitProcedure:
Exit Sub
ErrHandler:
Select Case Err.Number
Case Else
Application.ScreenUpdating = True
MsgBox Err.Number & vbNewLine & Err.Description,
vbCritical
Resume ExitProcedure
Resume
End Select
End Sub
This be unlock your VBA file. For further assistance kindly ask freely.
Thanks & Regards
Henry