I\'m trying to use Chip Pearson\'s code for overwriting an existing VBA code module with an import from another project. Original code here.
The particular section
I had the same issue with PowerPoint, but I guess the solution could apply to any Microsoft Office application implementing VBA.
I stopped having issues after I did Remove
in a separate procedure:
Public Sub RemoveVBComponent(ioVBComponents As VBComponents, ioVBComponent As VBComponent)
Call ioVBComponents.Remove(ioVBComponent)
End Sub
that I called this way:
With ToVBProject
Call RemoveVBComponent(.VBComponents,.VBComponents.Item(ModuleName))
End With