tags:

views:

229

answers:

1

Hi folks,

Is there any way to identify a formula of excel cell contains defined names by using VSTO?

Or is there any way to replace the defined Excel.Name in formula of a Excel cell when the name of Excel.Name is changed by using VSTO?

thanks,

Yst

A: 

I don't know if there is a direct built-in way to do that. However, you should be able to recognize and extract a name in the formula by getting the formula of the cell (Range.Formula), and analyzing the string, recognizing that a sequence of characters should be a named range if:
0) it isn't a number
1) it isn't a built-in function, which you could recognize by the fact that it is followed by a (
2) it isn't a cell name, i.e it isn't written as A1, $A1, A$1 or $A$1 Sounds like a fun Regex project!

Mathias