如何使用COM Interop或C Api以编程方式调用函数参数对话框 [英] How to call the Functions Argument Dialog programmatically using COM Interop or C Api

查看:60
本文介绍了如何使用COM Interop或C Api以编程方式调用函数参数对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我有一个带有在Excel中使用的UDF的XLL库。用户可以通过以下方式使用UDF:1)直接在单元格中键入UDF名称作为公式,2)或者通过启动  Function
Wizard Dialog
 并搜索特定的UDF,并在选择之后UDF, 
参数对话框
将显示该特定UDF。



我现在正在尝试创建一个  功能区   MSVS2017 / C#/ Office-Interop / VSTO  其中
显示  图库控件,下拉菜单包含所有UDF作为项目。当
a用户点击下拉列表中的任何UDF项目时, Function Arguments Dialog  应显示该UDF的



如何显示  函数参数对话框 对于使用Office-Interop / C#/ VSTO,
或甚至任何内置函数的特定UDF?


< p style ="padding-right:0px;行高:继承; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif;字体大小:15像素;垂直对齐:基线;明确:两者;颜色:#242729">
我在做了一些谷歌搜索后发现这个话题很少。 



启动  函数向导对话框。可以用
来完成这个:

   Globals    ThisAddIn   应用程序  对话框  [  Excel    XlBuiltInDialog    xlDialogFunctionWizard  ]。 显示 ();   



我希望你可以打开  功能参数对话框 用于任何类似
呼叫的UDF。我是否必须放弃尝试使用Office-Interop并使用Excel C Api呼叫? 

解决方案

找到解决方案。在调用函数向导对话框之前,需要使用UDF公式填充单元格。

 Globals.ThisAddIn.Application.ActiveCell.Formula =" = zAirAtmTPFC()" ;; 

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




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? 

解决方案

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();



这篇关于如何使用COM Interop或C Api以编程方式调用函数参数对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆