Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Protect VBA Project with code?????

Status
Not open for further replies.

Scottflyer

IS-IT--Management
Mar 15, 2003
4
US
Hi:

In VBA in Excel, does anyone know how to protect/unprotect the VBA project (not workbooks or worksheets) from within a code segment in a project? I want to modify a protected project using the .Remove and .Import methods but need to uprotect the modules before removing the old ones and then importing the new ones. E.g.

With VBP.VBComponents
.Remove VBP.VBComponents("Module3")
.Remove VBP.VBComponents("Module5")
End With

An error is thrown if this is attempted when the project is closed and protected. If open or unprotected, it works every time.

Thanks a lot for any help!!!!

Scottflyer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top