How to make an XLAM UDF call portable?

北战南征 提交于 2021-02-07 10:30:19

问题


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?


回答1:


This behaviour is a consequence of the way Addin UDFs are implemented in Excel.

There are 3 approaches to alleviating the problem:

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)



来源:https://stackoverflow.com/questions/7773283/how-to-make-an-xlam-udf-call-portable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!