Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default modules removing problem

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Removing modules and forms Daniel Bonallack Excel Programming 6 December 17th 08 11:49 PM
Excel cores when trying to close a workbook after exporting+removing VBA modules Tom Med Excel Programming 0 September 19th 07 07:00 PM
Removing modules via VBA ExcelMonkey Excel Programming 3 March 21st 07 03:50 PM
Removing VB Modules Automatically JNaugh Excel Programming 1 March 15th 06 07:00 PM
Problem with Userform and different code modules Jos Vens[_2_] Excel Programming 1 February 23rd 05 09:00 PM


All times are GMT +1. The time now is 04:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"