VBComponents.Remove method

P

Paolo F. Cantoni

Hi,

I can't get the .Remove method to work on VBComponents. I've managed to create an export routine to export the modules. Now I'm trying to re-import them. If I just use the .Import method, I get a new module with a counter on the end: MyModuleN, so I can see I need to remove the original module before importing the new one. However, I can't get the ..Remove method to work...

The relevant subroutine is:

Public Sub ImportModule(module As VBComponent, file As String, vbComponents As vbComponents)
Dim swMODULE_NAME As String
swMODULE_NAME = module.Name
Dim oVBComponent As VBComponent
Set oVBComponent = vbComponents(swMODULE_NAME)
vbComponents.Remove (oVBComponent)
Dim oModule As Object
Set oModule = vbComponents.Import(file)
Debug.Print vbTab & vbTab & "Module: " & swMODULE_NAME
End Sub

When I get to the:
vbComponents.Remove (oVBComponent)
statement, I get a 438 runtime error - Object doesn't support this property or method.

Can anyone help?

TIA,
Paolo Cantoni
 
P

Paolo F. Cantoni

Fixed it...

It was the parentheses around:
vbComponents.Remove (oVBComponent)
that caused the problem...

Remove them as in:
vbComponents.Remove oVBComponent
and it works as advertised...
HTH,
Paolo Cantoni


Hi,

I can't get the .Remove method to work on VBComponents. I've managed to create an export routine to export the modules. Now I'm trying to re-import them. If I just use the .Import method, I get a new module with a counter on the end: MyModuleN, so I can see I need to remove the original module before importing the new one. However, I can't get the ..Remove method to work...

The relevant subroutine is:

Public Sub ImportModule(module As VBComponent, file As String, vbComponents As vbComponents)
Dim swMODULE_NAME As String
swMODULE_NAME = module.Name
Dim oVBComponent As VBComponent
Set oVBComponent = vbComponents(swMODULE_NAME)
vbComponents.Remove (oVBComponent)
Dim oModule As Object
Set oModule = vbComponents.Import(file)
Debug.Print vbTab & vbTab & "Module: " & swMODULE_NAME
End Sub

When I get to the:
vbComponents.Remove (oVBComponent)
statement, I get a 438 runtime error - Object doesn't support this property or method.

Can anyone help?

TIA,
Paolo Cantoni
 

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

Top