View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Peter T[_7_] Peter T[_7_] is offline
external usenet poster
 
Posts: 162
Default Why full path in the formula to an UDF function?


"hbj" wrote in message
But, I found when retrieving user name, functions "Application.UserName"
does not return same value as Environ$("username"). What is the difference?

Application.UserName is an Excel property that you can configure in
Excel/Options
Environ$("username") returns the Windows login name

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


That should work providing 'trust access to VB Project' is enabled.
Ensure the addin has a unique project name and not VBAProject

Although the code is OK probably better to add references to a specified
workbook, depending on what's selected in project explorer the activeproject
might not be the one that's currently showing a module, eg

myBook.VBProject.References.AddFromFile()

Peter T