This project is read-only.

ActiveWorkbook.ChangeLink analogy in NPOI

Jun 13, 2012 at 12:44 PM

Hi,

I have a huge Excel model consisting of hundreds of Excel files, with references to one another. Every few months we copy the model to a new folder structure and increment a revision number in the file name. Then we have to update all the links between the Excel file. It's a tedious process and we're not allowed to remove the revision number from the filenames.

I've been using NPOI to enumerate the external links (which has helped a lot), but now I want to try to use NPOI to update the links to point to the new filenames too. 

I've tried just doing a string replacement on cell.CellFormula, but sometimes (due to other reasons), the new filename doesn't exist yet and I end up with a #REF error.

Is there any other way to easily update the links in a workbook? in VBA you would call ActiveWorkbook.ChangeLink. I'm looking for something easy and similar to that.

thanks,
Francois