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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Remove modules & Forms

Status
Not open for further replies.

JONBOY74

Technical User
Sep 11, 2001
36
US
Hi all

What is the VBA code for removing forms and code from a project. I've managed to add them but I'm now stuck.

Please help

Thanks

Jon
 
Before using these procedures, you'll need to
go into the VBA editor, go to the Tools menu,
choose the References item, and put a check
next to "Microsoft Visual Basic For
Applications Extensibility" library.


Sub delModule()

Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("Module1")
ThisWorkbook.VBProject.VBComponents.Remove VBComp

End Sub



Sub delForm()

Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("UserForm1")
ThisWorkbook.VBProject.VBComponents.Remove VBComp


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top