![]() |
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: |
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 |
All times are GMT +1. The time now is 02:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com