ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing a user form with code (https://www.excelbanter.com/excel-programming/287300-removing-user-form-code.html)

KimberlyC

Removing a user form with code
 
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



Jake Marx[_3_]

Removing a user form with code
 
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]


KimberlyC wrote:
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




All times are GMT +1. The time now is 07:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com