So I am using Excel-DNA to pack two COM dlls inside one XLL.
<ExternalLibrary Path="FancyDna.DllOne.dll" ExplicitExports="false" LoadFromBytes="true" ComServer="true" Pack="true" />
<ExternalLibrary Path="FancyDna.DllTwo.dll" ExplicitExports="false" LoadFromBytes="true" ComServer="true" Pack="true" />
And in VBA:
Sub TestEarlyBound()
Application.RegisterXLL Application.ActiveWorkbook.Path & "\build\FancyDna.Pack-AddIn64-packed.xll"
ThisWorkbook.VBProject.References.AddFromFile Application.ActiveWorkbook.Path & "\build\FancyDna.Pack-AddIn64-packed.xll"
Call CallDllOne
Call CallDllTwo
End Sub
However, when I add the references in VBA using ThisWorkbook.VBProject.References.AddFromFile
, only one Dll is referenced with checkbox ticked. The other dll shows up in the Tools --> References after doing that but its checkbox is not checked!
I saw it here that tlb's can be packed in XLL which in return can be referenced in VBA to get full early binding support.
It would be really cool to pack several Dlls in one XLL and also register them programmatically for early binding with intellisense and everything. What am I doing wrong here?
Only a single .tlb file can be embedded in the .xll.
So what you need to do is generate a single .tlb file from the multiple .NET assemblies. This will take some effort – I don’t know of a tool that will do this easily. See this StackOverflow question: Merging two .IDL files or two .tlb files into one file
Let us know if you try any of these!