Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default deleting userform or VBA modules by makro

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default deleting userform or VBA modules by makro

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)


"pat (belgium)" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default deleting userform or VBA modules by makro


-----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

--

HTH


Many thanks, your tip works super... :-)
RP
(remove nothere from the email address if mailing direct)


"pat (belgium)"

wrote in message
...
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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting blank modules bj Excel Discussion (Misc queries) 0 June 2nd 05 07:52 PM
Deleting modules in XLA ExcelMonkey[_190_] Excel Programming 2 February 27th 05 02:17 PM
When to code in sheet or userform modules and when to use modules Tony James Excel Programming 1 December 16th 04 10:02 PM
old makro (excel 95) should work with vba-modules Michael Gerstel Excel Programming 1 August 10th 04 12:32 PM
No success deleting modules BrianG[_4_] Excel Programming 1 October 18th 03 07:24 PM


All times are GMT +1. The time now is 03:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"