I'm working with a template where sheet names might change, but codenames will not. Is there a way to retrieve the codename of an Excel sheet in C#?
shCodeName = SH_parent.CodeName;
does not seem to work, although shName = SH_parent.Name;
works just fine
//Definition of SH_parent
Excel.Worksheet SH_parent;
//Loading SH_parent
foreach (Excel.Name N in WB.Names)
{
if (!N.Name.Contains("!"))
{
//GLOBAL
string SH_Name = N.RefersTo.ToString().Split('!')[0].Replace("=", "").Replace("'", "");
SH_parent= WB.Worksheets[SH_Name];
}
else
{
//SHEET
SH_parent = N.Parent;
}