I use the following code to remove modules from another open workbook (Wb). Normally, I pass the workbook to the sub routine and it runs fine. However, sometimes, the code will "jump" (that is my best description) to a module in the Wb workbook and stop altogether.
Any idea what might be causing this?
Any idea what might be causing this?
Code:
Private Sub removeModule(Wb as Workbook)
For Each Element In Wb.VBProject.VBComponents
Wb.VBProject.VBComponents.Remove Element
Next