ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing macros using VBA (https://www.excelbanter.com/excel-programming/308657-re-removing-macros-using-vba.html)

Tom Ogilvy

Removing macros using VBA
 
As the web page states at the top, you need to create a reference to the
Microsoft Visual Basic Extensibility Library.

--
Regards,
Tom Ogilvy

"jgranda" wrote in message
...
I am using the code from the pearson website but there is a case of user
error - me.

I am receiving the following error message:
"Compile error: User-defined type not defined"

The code I am using is:
Sub DeleteModule()
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("Module1")
ThisWorkbook.VBProject.VBComponents.Remove VBComp
End Sub

When I run the debugger, it is highlighting the line Dim VBComp As
VBComponent.

Can someone give me advice on how to correct?

Thanks,

Joe





All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com