问题描述
这篇文章是关于安装XLAM而不创建链接的。 (每个人都讨厌链接)。考虑这个微不足道的插件:
This post is about installing XLAM's without creating links. (Everyone hates links). Consider the trivial addin:
Public Function UDF_HELLO(x)
UDF_HELLO = "Hello " & x
End Function
将此代码放在模块中,并另存为Hello桌面上的.xlam(而不是在默认的excel加载项文件夹中)。接下来,当HELLO.XLAM仍然打开时,使用公式
Put this code and nothing else into a Module and save as "Hello.xlam" on the Desktop (and NOT in the default excel addins folder). Next, while HELLO.XLAM is still open, create a new XLSX workbook with the formula
=UDF_Hello("world")
,该单元格中只显示Hello world。保存工作簿并退出Excel。现在,如果您没有XLAM重新打开工作簿,Excel将抱怨链接到其他来源...。无论您单击更新还是不更新,Excel将会像下列那样在单元格A1中调整公式:
in cell A1, which simply displays "Hello world" in that cell. Save the workbook and exit Excel. Now, if you reopen the workbook without the XLAM, Excel will complain about "links to other sources ...". Whether you click "Update" or "Don't Update", Excel will mangle the formula in cell A1 like this:
='C:\Documents and Settings\tpascale\Desktop\Hello.xlam'!UDF_Hello("world")
很多时候这种强制联动是不可取的。在我的计算环境中,有很多特别的分析,对于每一个XLAM我们一起来解决一天的问题,施加一个安装方案是没有意义的。我只想把XLAM文件发给用户,让用户在需要时打开它们,而不必担心会导致他们的公式被弄脏的轻微错误。
Very often this "forced-linkage" is NOT desirable. In my computing environment there is a lot of ad-hoc analysis and it makes no sense to impose an install regimen on every XLAM we throw together to solve the problem of the day. I just want to hand out XLAM files to users and let those users open them when they need them, WITHOUT having to worry about the slightest mis-step causing their formulas to get mangled.
QUESTION:
有没有办法指示Excel不要为UDF构建外部链接,只需使用UDF,如果它们被加载并返回#VALUE,否则
Is there a way to instruct Excel to NEVER construct external links for UDFs, and simply to use UDFs if they're loaded and return #VALUEs otherwise ?
推荐答案
我不知道这样做。 xla / .xlam加载项。
I don't know of a way around this with .xla/.xlam add-ins.
但是.xll加载项不会出现此问题。
这些可以使用,或使用免费的 Excel-DNA 的管理类型,如VB.NET或C# a>图书馆
But this issue does not occur with .xll add-ins.These can be created in C using the Excel 2010 SDK, or in managed languages like VB.NET or C# using the free Excel-DNA library.
(免责声明:我是Excel-DNA的开发人员,这个问题是我用.xll接口进行管理UDF的原因之一加载项。)
(Disclaimer: I'm the developer of Excel-DNA. This issue is one of the reasons I went with the .xll interface for making managed UDF add-ins.)
这篇关于XLAM / XLA Addins:有更好的方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!