Removing a user form with code

  • Thread starter Thread starter KimberlyC
  • Start date Start date
K

KimberlyC

Hi

I have a worksheet that has a user form with some code behind the form. Is
it possible to run code from an addin worksheet that will remove that user
form and it's code?

Any help is greatly appreciated!!

Thanks,
Kimberly
 
Hi Kimberly,

Something like this should do it:

With ActiveWorkbook.VBProject
.VBComponents.Remove .VBComponents("UserForm1")
End With

You may have to modify your security settings via Tools | Macro | Security,
Trusted Sources tab, "Trust access to Visual Basic project" for it to work
at runtime.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]
 
Back
Top