B
Brijesh Shah
HI,
I have hit a wall here. I delete some modules using VBComponents.Remove.
After that, even if I save the workbook using Save method, the changes are
not saved. Does anyone has a clue? After I run the macro below it still asks
me if I want to save the changes when i close the workbook. Note the macro
to delete the modules is in the same workbook. So the macro is trying to
delete itself too.
Code
Dim obj As Object
Dim VBComps As Variant
Set VBComps = ThisWorkbook.VBProject.VBComponents
For Each obj In VBComps
If obj.Type = 1 Or obj.Type = 2 Then
VBComps.Remove obj
End If
Next
ThisWorkbook.Save
Thanks in advance,
Brij
I have hit a wall here. I delete some modules using VBComponents.Remove.
After that, even if I save the workbook using Save method, the changes are
not saved. Does anyone has a clue? After I run the macro below it still asks
me if I want to save the changes when i close the workbook. Note the macro
to delete the modules is in the same workbook. So the macro is trying to
delete itself too.
Code
Dim obj As Object
Dim VBComps As Variant
Set VBComps = ThisWorkbook.VBProject.VBComponents
For Each obj In VBComps
If obj.Type = 1 Or obj.Type = 2 Then
VBComps.Remove obj
End If
Next
ThisWorkbook.Save
Thanks in advance,
Brij