excel vba- userform problem

  • Thread starter Thread starter knight4
  • Start date Start date
K

knight4

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
 
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)
 
Back
Top