I have some Excel DNA worksheet functions. I have set-up a ribbon that that when a button is clicked, a formula gets written to the activecell, and then the functionWizard is opened. All of that works fine:
Relevant code:
//Helper Method to get a reference to the ActiveCell as dynamic
private dynamic CurrentCell
{
get
{
if (ExcelApp.ActiveWorkbook != null)
{
if (ExcelApp.ActiveSheet != null)
{
{
var address = ExcelApp.ActiveCell.Address;
return ExcelApp.ActiveSheet.Range(address);
}
}
}
return null;
}
}
//Example function written to a cell
public void OnButtonPressed(IRibbonControl control)
{
if (CurrentCell != null)
{
CurrentCell.Formula2 = "=MyExcelDna.TestFunction()";
ExcelApp.ActiveCell.FunctionWizard();
}
}
The problem is that when I try to select a range value in the spreadsheet to use in the Function Wizard, it selects it OK, but the normal "dancing ants"
visual clue (the dotted line that is normally drawn around the selected cells) as to what cells have been selected is missing.
If I close the function wizard and open it again, it all works as expected.
Any ideas?
Thanks,
Andrew