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

Hello! I want to remove about 30 modules in secend opened Workbook from
first opend Workbook -the instance excel.
This first workbook it is scheduler, wich generated periodically report from
model. This model contains about 30 modules, witch i have to remove before
report save.

In first workbook I running:

Dim objVbc As VBComponent
Set wb2 = workbooks (xxxxx)

For Each objVbc In Workbooks(wb2).VBProject.VBComponents
If objVbc.Type 0 And objVbc.Type < 4 Then
Workbooks(ActiveWorkbook.Name).VBProject.VBCompone nts.Remove
objVbc
Else
objVbc.CodeModule.DeleteLines StartLine:=1,
Count:=objVbc.CodeModule.CountOfLines
End If
Next objVbc

Unfortunately, this code does not work, but when I break the VBA code (after
this above code part ) all modules disappear and is OK!
Is it problem with refresh? What should I do? Help me , please! Thanx



 
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 10:07 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"