A
Adax
Hello, I have problem with this code:
For Each objVbc In Workbooks(wb).VBProject.VBComponents
If objVbc.Type > 0 And objVbc.Type < 4 Then
Workbooks(ActiveWorkbook.Name).VBProject.VBComponents.Remove
objVbc
Else
objVbc.CodeModule.DeleteLines
StartLine:=1,Count:=objVbc.CodeModule.CountOfLines
End If
Next objVbc
I have about 30 modules in workbook. Unfortunately, after modules removing
by above code always 2 modules aren't remove. What is the reason? Is it
possibility to refresh collection VBProject.VBComponents after each
removing?
Lines deleting works very well, but I can't remove all modules, please
help me
Greetings, Adax
For Each objVbc In Workbooks(wb).VBProject.VBComponents
If objVbc.Type > 0 And objVbc.Type < 4 Then
Workbooks(ActiveWorkbook.Name).VBProject.VBComponents.Remove
objVbc
Else
objVbc.CodeModule.DeleteLines
StartLine:=1,Count:=objVbc.CodeModule.CountOfLines
End If
Next objVbc
I have about 30 modules in workbook. Unfortunately, after modules removing
by above code always 2 modules aren't remove. What is the reason? Is it
possibility to refresh collection VBProject.VBComponents after each
removing?
Lines deleting works very well, but I can't remove all modules, please
help me
Greetings, Adax