excel - 如何让 Excel 加载项 (Excel 2007) 中的用户定义函数与自动完成功能配合使用?

标签 excel autocomplete user-defined-functions excel-addins

我创建了一个加载项,当我在表达式框中使用它时,自动完成功能不起作用。当我单击用户定义函数下的函数“f”按钮时,我确实看到了它们。我只是希望自动完成功能能够与它们一起使用,这样我就不必记住它们的名字,也不必每次都单击功能“f”按钮。

最佳答案

虽然这是一个旧线程,但似乎解决方案很少。我在 JKP 应用程序开发服务中找到了一个示例,最初由 Laurent Longre 发现。一项警告解释如下:

Disadvantage of this trick method, is that one is actually re-registering a function within the dll one uses, which might be used by any program

http://www.jkp-ads.com/Articles/RegisterUDF01.asp

此解决方案仅注册/取消注册 UDF,但用户仍然需要将工作簿另存为 .xlam 并安装插件。我使用以下代码自动将当前工作簿安装为 Excel 插件(如果您要更新插件,则需要添加一些错误捕获以确定插件是否已安装)。

'Saves current workbook as an .xlam file
sFile = Application.LibraryPath & "\" & "name_of_addin" & ".xlam"
ThisWorkbook.SaveAs sFile, 55
ThisWorkbook.IsAddin = True
'Adds temporary workbook
Workbooks.Add
'Installs the addin
Set oAddin = AddIns.Add(sFile , False)
oAddin.Installed = True
'Closes temporary workbook
Workbooks(Workbooks.Count).Close
MsgBox ("Installation Successful.  Please close Excel and restart.")
'Closes workbook without saving
Workbooks(sFirstFile).Close False

关于excel - 如何让 Excel 加载项 (Excel 2007) 中的用户定义函数与自动完成功能配合使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4137141/

相关文章:

c# - 删除条件格式

javascript - jQuery 自动完成 - 在不更改请求的情况下获取响应?

vb.net - 组合框中的 .NET 全文自动完成。有什么积极的方式来覆盖列表项吗?

Excel:如果找到则返回特定值

python - Pandas.read_excel : Unsupported format, 或损坏的文件:预期的 BOF 记录

excel - 带参数的 Power 查询和存储过程

python - Vscode 自动完成功能不适用于 Jupyter Notebook

vba - 替代命令 (ActiveSheet)

c - 在字符串中查找动词

c++ - 用于加密/解密的 Firebird 数据库 UDF 不释放内存