Removing modules and forms

Joined
Apr 12, 2007
Messages
2
Reaction score
0
I have these lines of code in my procedure to remove forms and modules.

For Each vbMod In ThisWorkbook.VBProject.VBComponents
ThisWorkbook.VBProject.VBComponents.Remove vbMod
Next vbMod

But I get this error:
Programmatic access to Visual Basic Project is not trusted

Can anyone tell me how to get around this?

Thanks in advance
Daniel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top