Hi all,
I am trying to remove a VBAProject that is present in the Project panel. The project I want to remove is not password protected. I also have Trust access to the VBA project object model turned on.
I keep getting an error stating “Run-time error 440: Method ‘Remove’ of object ‘_VBProjects’ failed”.
Does anyone know how to resolve this? Any help will be greatly appreciated!
I am trying to remove a VBAProject that is present in the Project panel. The project I want to remove is not password protected. I also have Trust access to the VBA project object model turned on.
VBA Code:
Sub RemoveProject()
Dim oVBProjects As Object
Dim oVBProject As Object
Set oVBProjects = Application.VBE.Projects
For Each oVBProject In oVBProjects
If oVBProject.Name = “projectToRemove”
Call oVBProjects.Remove(oVBProject)
End If
Next
End Sub
I keep getting an error stating “Run-time error 440: Method ‘Remove’ of object ‘_VBProjects’ failed”.
Does anyone know how to resolve this? Any help will be greatly appreciated!