View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Removing macros using VBA

Change this line

Dim VBComp As VBComponent

to

Dim VBComp As Object

no need for a reference then.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"jgranda" wrote in message
...
Thank you for that information regarding references. I do not have

"Visual
Basic for Applications Extensibility Library" listed. I have "Visual

Basic
for Applications" checked but there are also several other "Visual Basic

for
Applications" unchecked with no descriptions on the differences. How do I
add the Extensibility Library?

"Norman Jones" wrote:

Hi Jgranda,

In the VBE | Tools | References | find and check the Visual Basic For
Applications Extensibility library.

---
Regards,
Norman



"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