Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Uzytkownik "Chip Pearson" napisal w wiadomosci
... The first flag I see raised is Workbooks(ActiveWorkbook.Name). Are you really sure you want to remove modules from the ActiveWorkbook? A better solution is to set a reference to the workbook whose modules you want to remove and always use that reference. E.g., Dim DeleteFromWB As Workbook Dim VBComp As VBIDE.VBComponent Set DeleteFromWB = Workbooks("Book3.xls") For Each VBComp In DeleteFromWB.VBProject.VBComponents Select Case VBComp.Type Case vbext_ct_ActiveXDesigner, vbext_ct_ClassModule, _ vbext_ct_MSForm, vbext_ct_StdModule DeleteFromWB.VBProject.VBComponents.Remove VBComp Case Else With VBComp.CodeModule .DeleteLines 1, .CountOfLines End With End Select Next VBComp Thank You very much! but unfortunatelyit dosn't work tooo! :) This problem I try solve since several months and without result. Your and my code works when I start this code from empty workbook. When I add it to my scheduler with many modules I noticed importand observation: when I breake code after this removing code, immediately all modules disappears.... Problem with collection refresh? I see, missing collection refresh... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Removing modules and forms | Excel Programming | |||
Excel cores when trying to close a workbook after exporting+removing VBA modules | Excel Programming | |||
Removing modules via VBA | Excel Programming | |||
Removing VB Modules Automatically | Excel Programming | |||
Problem with Userform and different code modules | Excel Programming |