ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing a Form from VB Automatically (https://www.excelbanter.com/excel-programming/348260-removing-form-vbulletin-automatically.html)

Trey via OfficeKB.com

Removing a Form from VB Automatically
 
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("User Form1")
ActiveWorkbook.VBProject.VBComponents.Remove VBComp

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1

lotus[_7_]

Removing a Form from VB Automatically
 

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!


--
lotus
------------------------------------------------------------------------
lotus's Profile: http://www.excelforum.com/member.php...o&userid=23759
View this thread: http://www.excelforum.com/showthread...hreadid=493989



All times are GMT +1. The time now is 11:27 PM.

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