开发者

How do I check if a name is in use in Excel using VSTO?

I need to know if a name is already in use in Excel (for example as a named range) so that I do not 开发者_运维百科allow the attempted creation of duplicate names. I tried the following but the loop body never executes (there are no exceptions thrown, it just looks like the collection is empty).

Can anyone suggest and alternative?

foreach (Excel.Name n in _workbook.Names)
{
    if (n.Name == name) return true;
}
return false;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜