ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel vba- userform problem (https://www.excelbanter.com/excel-programming/292511-excel-vba-userform-problem.html)

knight4[_3_]

excel vba- userform problem
 
I am working on a program that includes some vba code to create
userform, together with associated controls, ie buttons and imag
controls. This is working fine, but i now need to find a way to remov
the userform from within vba. The user form is created from data on a
excel worksheet, if the user changes the information on the workshee
then i need to remove the userform and then recreate it so that i
picks up the latest information. Does anybody know of a way that i ca
achieve this using vba? I would appreciate any ideas you may have

Many thanks

Knight

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

excel vba- userform problem
 
This code will completely remove a module

Dim VBComp As VBComponent

Set VBComp = ThisWorkbook.VBProject.VBComponents("Userform1")
ThisWorkbook.VBProject.VBComponents.Remove VBComp

You need to add a reference to the Visual Basic for Applications
Extensibility library, but you probably already have that for the other
code.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"knight4 " wrote in message
...
I am working on a program that includes some vba code to create a
userform, together with associated controls, ie buttons and image
controls. This is working fine, but i now need to find a way to remove
the userform from within vba. The user form is created from data on an
excel worksheet, if the user changes the information on the worksheet
then i need to remove the userform and then recreate it so that it
picks up the latest information. Does anybody know of a way that i can
achieve this using vba? I would appreciate any ideas you may have

Many thanks

Knight4


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 09:46 AM.

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