Free Support Forum -

Clear range.Name OR clear excel.Worksheets.GetNamedRanges()

Hi Laurence,

I'm wring excelsheets and give names to ranges. After that, I save the excelfile and load it again. Afer loading I call "excel.Worksheets.GetNamedRanges()" an I get, as expected, all names I'm given before.
When I now give a cell a name witch has already a name, aspose is adding the name to the namecollection. But what I want to do is to overwrite the existing name?
Is this possible?
I became me is also enough if I'm be able to clear the namecollection before writing the names the second time. Any way to do this?

Regards, Stefan

//Set A1 name to overwrite name "ExistRange"

Range range = excel.Worksheet[0].Cells.CreateRange(0, 0, 1, 1);

range.Name = "ExistRange";

//Clear name collection