如何使XLAM UDF呼叫便携式? [英] How to make an XLAM UDF call portable?
问题描述
似乎当我在XLAM文件中调用UDF时,XLAM文件的路径已嵌入在电子表格中.当我从另一台计算机(安装了相同的XLAM加载项,只是安装到其他路径)打开电子表格时,Excel抱怨此工作簿包含指向其他数据源的链接..."这似乎不是XLL中UDF的问题.有办法解决吗?
It seems that when I call a UDF in an XLAM file, the path to the XLAM file is embedded in the spreadsheet. When I open the spreadsheet from another machine (which has the same XLAM add-in installed, just installed to a different path) then Excel complains "This workbook contains links to other data sources..." This doesn't seem to be a problem with UDFs in XLLs. Is there a way around this?
推荐答案
此行为是Excel中实现Addin UDF的方式的结果.
有3种缓解问题的方法:
This behaviour is a consequence of the way Addin UDFs are implemented in Excel.
There are 3 approaches to alleviating the problem:
使用强制安装特定路径的安装程序
向XLAM添加一些代码,以检查每个打开的工作簿的链接,如果该链接指向您的XLAM,但在不同的路径中进行查找和替换,以便
将XLAM UDF转换为XLL(如果VBA转换为VB.Net并使用Excel DNA或Addin Express制作VB.Net XLL)
Use an installer that forces a particular path
Add some code to the XLAM that inspects Links for each workbook opened and if the link is to your XLAM but in a different path it does a find and and replace so that the path is corrected.
Convert your XLAM UDFs to XLLs (if VBA convert to VB.Net and use Excel DNA or Addin Express to make a VB.Net XLL)
这篇关于如何使XLAM UDF呼叫便携式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!