FunctionWizard problem - no marching ants?

25 views
Skip to first unread message

CFC GOTM

unread,
Sep 10, 2026, 2:54:48 AMSep 10
to Excel-DNA
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

CFC GOTM

unread,
Sep 10, 2026, 5:46:50 PMSep 10
to Excel-DNA
OK - solved it.  Show the dialog instead.


//Example function written to a cell
public void OnButtonPressed(IRibbonControl control)
{
    if (CurrentCell != null)
    {
        CurrentCell.Formula2 = "=MyExcelDna.TestFunction()";
        //ExcelApp.ActiveCell.FunctionWizard();
        ExcelApp.Dialogs[Excel.XlBuiltInDialog.xlDialogFunctionWizard].Show();
    }
Reply all
Reply to author
Forward
0 new messages