2016-11-16 15 views
0

我知道,有在ErrorHAndler.dna example所示的方法:获得在定制ExcelDNA异常处理程序调用功能,无需MacroType

private object ErrorHandler(object exceptionObject) 
{ 
    ExcelReference caller = (ExcelReference)XlCall.Excel(XlCall.xlfCaller); 

    // Calling reftext here requires all functions to be marked IsMacroType=true, which is undesirable. 
    // A better plan would be to build the reference text oneself, using the RowFirst/ColumnFirst info 
    // Not sure where to find the SheetName then.... 
    string callingName = (string)XlCall.Excel(XlCall.xlfReftext, caller, true); 

    [...] 

} 

但有没有人来确定如何在注释中所描述的问题可能会得到解决?即有没有办法做到这一点没有设置IsMacroType=true

回答

0

你不需要IsMacroType=true来调用者(你的示例中的第一行工作正常,没有它)。如示例中的注释所示,如果要为范围构建文本说明,则需要从ExcelReference的行/列信息中自行构建它。您可以拨打XlCall.Excel(XlCall.xlSheetNm, caller)来获得表格名称。

相关问题