Replied 8 September 2017, 3:23 pm EST
I am not sure it is possible to use Spread directly that way, because of the way that licensing works and the way that VBA works.
The problem is, VBA does not support the distinction between run-time and design-time -- VBA is always operating in design-time mode, even when you are running forms and interacting with controls. There is simply no support for the concept of "compiling" or "building" in VBA (since everything is interpreted dynamically) and all controls are always created in "design mode."
Because of this, third-party licensed controls like Spread cannot work in VBA, as the developer license cannot be embedded in the VBA code.
I think even if you create a licensed add-in component, it would not work to use Spread inside VBA, as the component licensing implementation for your add-in component would fail for the same reason that Spread's licensing fails, as described above.
The way that the .NET component licensing works, if you create a UserControl component which contains an instance of FpSpread, then that UserControl will require the license for Spread on the machine where it is used in design time (e.g. if a developer tries to use the UserControl DLL without the FpSpread license, it will fail to create in design time). However, if the UserControl is licensed (using LicenseProvider attribute) and Spread is licensed in the UserControl DLL project (inside its LICX), then it should work to use that UserControl in run-time in an application that was created without the license for Spread but with the license for the UserControl. The application would need to be built on a machine that is actually licensed for Spread development (since the UserControl's design-time license check will recursively call Spread's design-time license check), but the Spread's license does not need to be built directly into the application EXE (e.g. you do not need to include the type for FpSpread in the LICX for the application, as this will be included automatically by the UserControl's license). When the application is built, the license resource generated by lc.exe from the LICX will contain all the licenses required by the types listed in the LICX including any contained types, but only the run-time license keys for those components, for creating them in run-time mode.
Since VBA always creates components and controls in design-time mode, there is not any way to make any component or control create in VBA unless the design-time license is present on the machine (e.g. you have installed Spread for development on the machine).
Sorry for the inconvenience! I do not think there is any workaround for this, but you can post a sample showing the problem if you would like us to look into it some more and try to make it work.