Removing a Form from VB Automatically

  • Thread starter Thread starter Trey via OfficeKB.com
  • Start date Start date
T

Trey via OfficeKB.com

Does anyone know how to remove or delete a from.
I can do this with a module but am having issues with a Form. Here is the
syntaxt I use for a module

Set VBComp = Workbooks(RollUpProg).VBProject.VBComponents("UserForm1")
ActiveWorkbook.VBProject.VBComponents.Remove VBComp
 
Sub test()

Dim x As Object
Set x = Application.VBE.ActiveVBProject.VBComponents

'Delete the item which is not required.
x.Remove vbcomponent:=x.Item("UserForm1")

End Sub


It works!
 
Back
Top