H
huyeote
Gurus,
I have a procedure to delete all existing modules from a chosen
workbook if the type of the component is not vbext_ct_Document. The
extract of the code is here:
'--- code starts here -----------------------------
Set VBProjTo = xlbk.VBProject
With VBProjTo
For Each VBComp In .VBComponents
If VBComp.Type <> vbext_ct_Document
Then
.VBComponents.Remove VBComp
End If
Next VBComp
End With 'vbprojto
'--- code ends above ------------------------------
I found the code works fine in some workbooks but in others a few
modules may still remains in the project after the code run. Anyone
has any idea why some modules can't be removed?
Thanks,
Huyeote
I have a procedure to delete all existing modules from a chosen
workbook if the type of the component is not vbext_ct_Document. The
extract of the code is here:
'--- code starts here -----------------------------
Set VBProjTo = xlbk.VBProject
With VBProjTo
For Each VBComp In .VBComponents
If VBComp.Type <> vbext_ct_Document
Then
.VBComponents.Remove VBComp
End If
Next VBComp
End With 'vbprojto
'--- code ends above ------------------------------
I found the code works fine in some workbooks but in others a few
modules may still remains in the project after the code run. Anyone
has any idea why some modules can't be removed?
Thanks,
Huyeote