VBComponent参考工作表标签名称
问题描述:
Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents("Sheet10")
我有上面的代码。目前Sheet10在excel选项卡中被命名为SummaryTab。我想使用excel选项卡中的名称来引用VBComponent。这意味着我想用类似VBComponent参考工作表标签名称
Set VBComp = VBProj.VBComponents("SummaryTab")
但是,上面的代码给了我错误。我怎样才能解决这个问题?
答
您可以使用
Set VBComp = VBProj.VBComponents(Worksheets("SummaryTab").CodeName)
如此接近,我可以闻到它,良3个工作日;) –
@ShaiRado - 洛尔 - 但我在** **假期 - 我没有为我在假期时有很多空闲时间! – YowE3K