Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Remove VBE Component failed

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 he

'--- 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Remove VBE Component failed

Looks like it should work. The next step is to step through the code and
see why it doesn't. No chance the module remaining is the one with this
code in it right?

--
Jim
wrote in message
...
| 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 he
|
| '--- 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Remove VBE Component failed

Thanks Jim,

I used F8 to step through the code and watch the changes in VBE's
Project Explorer windows and found my code worked in some workbooks.
However in some other workbooks the wierd thing is the module still
remained after getting past the .Remove method and no error was
reported. And then a new module with the same name and indexation (eg.
module1 or module2) was injected after the execution of importing code
from a temp file which was not quoted here.

A possible bug in VBA?

Huyeote

On Nov 17, 1:09 am, "Jim Rech" wrote:
Looks like it should work. The next step is to step through the code and
see why it doesn't. No chance the module remaining is the one with this
code in it right?

--
wrote in message

...


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
add automatically a component to component palette Maileen[_4_] Excel Programming 0 February 20th 06 04:06 PM
Worksheet in VB COMPONENT Al Excel Programming 3 May 6th 05 07:48 PM
Spreadsheet web component Phil Excel Programming 0 September 27th 04 03:59 PM
is there any Text component ? Marek Excel Programming 1 September 4th 04 02:28 PM
Chart component Mika[_2_] Excel Programming 0 June 6th 04 04:23 PM


All times are GMT +1. The time now is 11:57 AM.

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

About Us

"It's about Microsoft Excel"