Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Remove missing reference programmatically

Hello,

I am accessing Excel object from a C# plugin. Sometimes in my target
documents there are missing Compoment references, which I should remove.

I use the following fragment of code to do this:


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Remove missing reference programmatically

Hello,

I am accessing Excel object from a C# plugin. Sometimes in my target
documents there are missing Compoment references, which I should remove.

Sorry, I sent it incomplete mistakenly. Here's the whole message.
---

I use the following fragment of code to do this:


for (int j = 1; j <= wbk.VBProject.References.Count; j++)
{
VBIDE.Reference myref = wbk.VBProject.References.Item(j);

if (myref.IsBroken == true)
{
wbk.VBProject.References.Remove(myref);
}
}

The problem is that I get the following exception: for (int j = 1; j <=
wbk.VBProject.References.Count; j++)
{
VBIDE.Reference myref = wbk.VBProject.References.Item(j);

if (myref.IsBroken == true)
{
wbk.VBProject.References.Remove(myref);
}
}

The problem is that I get the following exception: "Object library not
registered". But the reference is still there and I cannot add fresh
reference to the project "Name conflicts with existing module, project, or
object library".

Do you have any suggestion how I get out of this mess and remove the missing
reference successfully?

Thank you for your time,
Nacho


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
How to programmatically remove an AddIn (xla) AndyB Excel Programming 1 July 6th 04 06:38 AM
Programmatically remove sharing? Anson[_2_] Excel Programming 0 June 14th 04 08:11 PM
Programmatically Add Reference` keepitcool Excel Programming 1 September 16th 03 05:30 PM
Programmatically Add Reference` Jean-Paul Viel Excel Programming 0 September 16th 03 02:23 PM
Can i set a reference programmatically? Tom Ogilvy Excel Programming 1 August 19th 03 04:24 PM


All times are GMT +1. The time now is 09:45 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"