none
How to call the Functions Argument Dialog programmatically using COM Interop or C Api RRS feed

  • Question

  • I have a XLL library with UDFs used in Excel. Users can use the UDFs by 1) either directly typing the UDF name in a cell as a formula, 2) or by launching the Function Wizard Dialog and search for the specific UDFs, and after selecting an UDF, the Function Argument Dialog will be displayed for that specific UDF.

    I'm now trying to create a Ribbon with MSVS2017/C#/Office-Interop/VSTO which show Gallery Controls with drop down menus containing all UDFs as items. When a user clicks on any of the UDF items in the drop down, the Function Arguments Dialog should be displayed for that UDF.

    How do you show the Function Arguments Dialog for a specific UDF using Office-Interop/C#/VSTO, or even for any built in function?

    I have found very little on the topic after doing some googling. 

    It seems to be quite easy to launch the Function Wizard Dialog. It can be done with this:

    Globals.ThisAddIn.Application.Dialogs[Excel.XlBuiltInDialog.xlDialogFunctionWizard].Show();

    I hope you can open the Function Arguments Dialog for any UDF with a similar call. Do I have to give up trying Office-Interop and use a Excel C Api call? 

    Tuesday, May 15, 2018 9:21 AM

All replies

  • Found the solution to this. You need to populate the cell with an UDF formula before calling the function wizard dialog.

    Globals.ThisAddIn.Application.ActiveCell.Formula = "=zAirAtmTPFC()";
    
    Globals.ThisAddIn.Application.Dialogs[Excel.XlBuiltInDialog.xlDialogFunctionWizard].Show();


    Tuesday, May 15, 2018 12:38 PM
  • Hello JohanAhi,

    It's good news to hear that you have resolved the issue. I would suggest you mark your solution as answer to close the thread. People who runs into the same issue will this it helpful for them.

    If you have any other issue, please feel free to post threads to let us know.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 16, 2018 2:26 AM