deleting userform or VBA modules by makro

  • Thread starter Thread starter pat \(belgium\)
  • Start date Start date
P

pat \(belgium\)

For security reasons (unwanted use of self made program)
I want to delete a selfmade Userform(FrmEsti) and a Module
in a pasword protected VBAProject named (Est.xls), first I
have allready removed some sheets as follows :

Sheets(Array("Text", "Data")).Select
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
ActiveWorkbook.Save
Application.DisplayAlerts = True
ActiveWorkbook.Close

Can I do a simular thing with a complete VBAproject
or only the Forms and/or Modules before saving the
file ??? Many thanks for a not to complicated solution...
I'm only a homemade programmer. Kind regards, pat
 
Pat,

This is how to delete a userform module

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

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
-----Original Message-----
Pat,

This is how to delete a userform module

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

Many thanks, your tip works super... :-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top