How to programmatically load an XLL file into Excel when it is linked to other DLLs. Using c# winforms application + Excel Automation I’m creating Excel Application object. Then I’m using:
bool bXllLoadSuccess = _excelApp.RegisterXLL(_pathXll);
It is OK when XLL is self-contained. The problem occurs when it depends on other DLLs. Even when I put them into the same folder Excel doesn’t want to pick them up. I tried to do following before loading the XLL but it doesn’t help:
_excelApp.DefaultFilePath = Path.GetDirectoryName(_pathXll);
I have tried this one as well:
Directory.SetCurrentDirectory(Path.GetDirectoryName(_pathXll));
Dependency walker shows no issues – all required files are in the same folder with the XLL. Any ideas?
Thanks.
UPD: I tried copying all requried dlls into a folder and then added it's path to PATH variable. Didn't help :)
UPD2: I tried to change current directory for both c# app and Excel application object at the same time. Didn't help :(