View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
hbj hbj is offline
external usenet poster
 
Posts: 35
Default Why full path in the formula to an UDF function?

On Wednesday, June 15, 2016 at 4:34:52 PM UTC+3, Peter T wrote:
"hbj" wrote in message
Sorry Isabelle I could not express myself clearly enough. The point is: I
want to completely get rid of the full path in front of the function.
Because I have loaded the UDF, Excel should know that the function is in the
loaded UDF w/o explicitly insert the path. As far as I understand the
problem is how should I load the UDF in a way that Excel knows that its
instance is loaded and the full path name is not required.
Håkan

=============================

I don't think you've given us the complete picture. Is the UDF actually
working in formulas that contain an address to the addin, and not a case of
needing to update links?

Peter T


Hello Isabelle and Peter,

I think Isabelle is quite right, though explained the solution simply. After studying the case a while I understood that an UDF behaves differently from Excel internal functions in that way, that Excel needs the path to the XLAM. This file should point to the same folder in every machine. If not, Excel shows up the full path to the XLAM. The location of this file is different in each computer. Here Isabelles suggestion is the solution: Load the xlam programmatically on worksheet open. The file resides in C:\<USER\Dropbox\common, where <USER is different in each computer. So, so far solved. Thank you folks.
But, I found when retrieving user name, functions "Application.UserName" does not return same value as Environ$("username"). What is the difference?

I also try to load the XLAM to references with command
Application.VBE.ActiveVBProject.References.AddFrom File <FullPathToXLAM.
Is returns error code 32813 "Application-defined or object-defined error".

Håkan