View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default 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/