Hello All,
I'm hoping someone can help me out with something I've been having trouble with. Within Excel, it is possible to give a Range a name. In a VBA macro for example this can be done by doing the following:
ActiveWorkbook.Names.Add Name:="adfasdf", RefersToR1C1:="=Sheet1!R4C2"
Similarly, the name for this range can be deleted by doing:
ActiveWorkbook.Names("adfasdf").Delete
My issue is that I don't want to use those macros, I want to program using the C# Office Interop tools. I can easily add a name by doing something like:
destWB.Names.Add(...);
and filling in the parameters, that is no problem. When it comes to deleting however, I just can't get it to delete. I use the following code:
((Excel.Name)destWB.Names.Item("Test", Missing.Value, Missing.Value)).Delete();
where destWB is a Workbook. There is also a name in my sheet called "Test". The name just won't go away! I've looked up a lot of other ways of doing it. Usually doing the same as the VBA macro will work (slightly changing syntax), but not this time. Hopefully someone has some input. Thanks a lot for your time,
Luc Gallant
Bookmarks