Why does Excel require Spreadsheet link for an Add-in which was created in Library Compiler?

2 views (last 30 days)
I have created an Excel Add-In with Library Compiler. Trying to use the macro a machine without Matlab installed, results in Excel throwing: "Compile error: Can't find the project or library". When checking the references, as described here, excllink.xlam (the Spreadsheet link Add-In file) is prefixed with MISSING. As I understand it, Excel requires Spreadsheet Link to run the macro. However, my Matlab function doesn't use Spreadsheet Link. Furthermore, according to the documentation about Matlab Compiler, Matlab runtime, and the GettingStarted file generated by the installer, everything required to run an Add-In created with Library Compiler should be installed and proprely set up by the web installer, as I understand it.
I have also tested the Add-In on my machine and one other, which had Matlab installed, with good results. Both had Spreadsheet Link installed.
The basic structure of the function is:
function result = fcn(type, data)
close all;
CH4 = data(:, 1);
C2H4 = data(:, 2);
C2H2 = data(:, 3);
points = [1/2*(2*C2H4 + CH4), sqrt(3)/2*CH4];
result = cell(length(data(:, 1)), 1);
if startswith(type, "V") == true
figFcn1(); % Creates a figure with a ternary plot.
% For-loop with if-else statement which populates result based
% on each datapoint in CH4, C2H4 and C2H2.
else
figFcn2(); % Creates a figure with a different ternary plot.
% For-loop with similar if-else statement.
end
hold on
plot(points(:, 1), points(:, 2), 'r+')
hold off
end
If I have omitted anything relevant, please notify me.

Answers (1)

Nivedita
Nivedita on 16 Nov 2023
From the information provided, it seems like your Excel Add-In generated using MATLAB Compiler is trying to reference the Spreadsheet Link EX (excllink.xlam), which is not present on the machines without MATLAB installed.
Even though your MATLAB function does not use Spreadsheet Link EX, Excel might still be trying to load this reference if it was present when the Add-In was created. Here are some potential solutions:
1. Remove the Spreadsheet Link EX reference from Excel: Open Excel, go to 'Developer' -> 'Visual Basic' -> 'Tools' -> 'References' and uncheck the 'MISSING: excllink.xlam' reference.
2. Create the Add-In on a machine without Spreadsheet Link EX installed: If possible, try to create the Excel Add-In on a machine that does not have Spreadsheet Link EX installed. This way, Excel will not try to add this reference when the Add-In is created.
3. Install Spreadsheet Link EX on the target machines: If all else fails, you could consider installing Spreadsheet Link EX on the machines where you want to use the Add-In. However, this might not be ideal if you're trying to avoid installing additional software.
I hope this helps!
Regards,
Nivedita.

Categories

Find more on Data Export to MATLAB in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!