Application.RegisterXLL return false

2k views Asked by At

I tried to call Application.RegisterXLL to load my own xll in excel 2013, but it failed with returning false. I have checked Macro and Add-ins Settings but have no effect. Is there any way to get more detailed error description? The code is as following.

mypath = Application.ActiveWorkbook.Path

rs = mypath + "\AddIn.xll"
rc = Application.RegisterXLL(rs)

Any help or insight would be greatly appreciated. Thanks!

3

There are 3 answers

2
Malick On

If your xll is dependent of external dlls , you need to change the current directory to the xll folder before to call Application.RegisterXll .

Also be sure to put all your dependencies in the same folder as your xll.

See also this answer.

0
Guest On

Make sure your DLL is compiled with the same architecture (x86 vs x64) that your Office runs. Attempting to import a x86 DLL into a x64 version of Excel (or the opposite) will fail and return false.

0
AnotherParker On

You can download Dependency Walker for free from http://www.dependencywalker.com, start it up, then open Excel.exe from inside it. Then choose Profile->Start Profiling. It will launch Excel (2-5 times more slowly than usual) and a whole bunch of debugging information will show up. Then try to register your XLL and see what additional stuff shows in the window. Most likely the XLL will be listed in red and hopefully it will show whether the problem is with itself or one of its dependent DLLs.