Remove VBA Project

LolaFahmi

New Member
Joined
Feb 13, 2022
Messages
1
Office Version
  1. 365
Platform
  1. Windows
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.

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!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Hi, a trick to remove all code from a workbook is to save it as .xlsx …​
 
Upvote 0

Forum statistics

Threads
1,215,215
Messages
6,123,668
Members
449,114
Latest member
aides

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top