从命名范围的Name对象获取工作表名称 [英] Get sheet name from a named range's Name object

查看:121
本文介绍了从命名范围的Name对象获取工作表名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有:

Microsoft.Office.Interop.Excel.Workbook wb;
Microsoft.Office.Interop.Excel.Name name;

在给定的工作簿中有没有办法获取命名范围所在的工作表名称,假设我已经得到了命名范围的Name对象和wb?

Is there any way to get the worksheet name that the named range is on in the given workbook, assuming I've gotten the named range's Name object and wb already?

推荐答案

是的,使用属性在对象层次结构上工作:

Yes, use the Parent property to work your way up the object hierarchy:

ws = name.RefersToRange.Parent.name;

这篇关于从命名范围的Name对象获取工作表名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆