Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Delete All Macros

Hi Rob,

You need to set a reference the visual Basic Extensibility library:

VBA Menu | Tools | References


---
Regards,
Norman



"Rob" wrote in message
...
I have a workbook that contains several macros that manipulate and
calculate
data for billing to be sent to a client. After all calculations are
performed, I will be copying a pasting the worksheets to themselves as
values
only so that the client will not be able to see the formulas. Afterwards,
I
would like to delete all the macros as well. I found the following code
through the discussion group:

Sub DeleteAllVBA()

Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents

Set VBComps = ActiveWorkbook.VBProject.VBComponents

For Each VBComp In VBComps
Select Case VBComp.Type
Case vbext_ct_StdModule, vbext_ct_MSForm, _
vbext_ct_ClassModule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
.DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp

End Sub


However, when I try to run this macro, I get an error message at the very
first line that says:

Compile Error:

User defined type not defined

Obviously I would like to know what to change and how to delete all the
macros, including the one that is being written to delete the macros.

Can anyone help?



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Delete All Macros

Hi Rob,

For additional information, see Chip Pearson's Programming To The Visual
Basic Editor page at:


http://www.cpearson.com/excel/vbe.htm

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Rob,

You need to set a reference the visual Basic Extensibility library:

VBA Menu | Tools | References


---
Regards,
Norman



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
Delete All Macros Hardeep_kanwar[_2_] Excel Worksheet Functions 1 October 31st 08 11:21 AM
delete macros AhmetDY Excel Discussion (Misc queries) 2 October 18th 07 10:07 AM
delete macros sandy Excel Worksheet Functions 1 July 11th 07 11:01 PM
How to Delete Another WorkBook Macros using Macros.. Possible? ddiicc Excel Programming 7 July 24th 05 01:54 PM
How to delete macros Jaime Stuardo Excel Discussion (Misc queries) 2 February 14th 05 02:29 PM


All times are GMT +1. The time now is 03:41 PM.

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"