| 发表于:2007-03-18 19:08:354楼 得分:0 |
private sub commandbutton1_click() dim objvbc as object dim objmdl as object dim arr() as variant dim intcounter as integer dim txt as string redim arr(1 to 3, 1 to activeworkbook.vbproject.vbcomponents.count) intcounter = 0 for each objvbc in activeworkbook.vbproject.vbcomponents set objmdl = objvbc.codemodule '引用單無內的程式碼 intcounter = intcounter + 1 arr(1, intcounter) = objvbc.type arr(2, intcounter) = objvbc.name if objmdl.countoflines > 0 then txt = objvbc.codemodule.lines(1, objmdl.countoflines) end if arr(3, intcounter) = txt select case arr(1, intcounter) case 1 'module activeworkbook.vbproject.vbcomponents.remove objvbc case 2 'class1 activeworkbook.vbproject.vbcomponents.remove objvbc case 3, 100 'userform or thisworkbook objvbc.codemodule.deletelines 1, objmdl.countoflines doevents end select next objvbc end sub | | |
|