I am using the following code to turn off the VB protection on a project:
Sub UnprotectVBProject()
Dim VBProj As Object
On Error Resume Next
Set VBProj = ActiveWorkbook.VBProject
Application.SendKeys "Range", True
Application.SendKeys "~", True
VBProj.VBE.SelectedVBComponent.Activate
On Error GoTo 0
End Sub
Which works great if the editor is already open, but if the editor is not open it does not work.
How can I open the VB editor with code? It must be simple and I feel silly asking, but it not very apparant to me. Is it something like Application.VBE.open?
Thanks,
Woody Hays
Sub UnprotectVBProject()
Dim VBProj As Object
On Error Resume Next
Set VBProj = ActiveWorkbook.VBProject
Application.SendKeys "Range", True
Application.SendKeys "~", True
VBProj.VBE.SelectedVBComponent.Activate
On Error GoTo 0
End Sub
Which works great if the editor is already open, but if the editor is not open it does not work.
How can I open the VB editor with code? It must be simple and I feel silly asking, but it not very apparant to me. Is it something like Application.VBE.open?
Thanks,
Woody Hays