LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 97 using ActiveX writing Excel files in an executable

Hi!

 

I'm having trouble solving an issue in my executable. I implemented a data export feature which will write measurement data into an .xls file using ActiveX. Ever since I've used LibreOffice to open these files. Last week I installed and licenced Office 2019 and since then I'm recieving "Error 97 invalid reference" whenever I want to export my data as an .xls. Even uninstalling Office 2019 again did not resolve the issue.

 

What's weird to me: When I run the EXE from desktop I get the error. But when I move the EXE into the LabVIEW project folder, the error does not appear and the Excel export works fine. So it must be something with the Excel references in my VIs getting broken. How can I fix that? Any ideas?

0 Kudos
Message 1 of 7
(985 Views)

It looks like a path issue, maybe you have relative path thus not working outside from the project folder.

Check where and how you access the writing files.

0 Kudos
Message 2 of 7
(976 Views)

The problem is that the Excel (and other Microsoft Office) ActiveX libraries have certain functions that use different number of parameters between versions. LabVIEW determines the calling interface at time of code compilation so whatever your development computer uses as ActiveX component version determines what version your executable can support. Specifically the SaveAs methods in Microsoft Office tend to be extended with every version update.

 

While ActiveX would allow dynamic runtime invocation of functions with optional parameters, this is unfortunately not how LabVIEW has implemented that interface. Strictly speaking it does use the IDispatch interface that is used for Dynamic runtime invocation but it uses information from the according type library at compile time to build that interface. When the ActiveX component later changes that interface because of a version change it is not compatible to the static information that LabVIEW build at compile time and the call fails.

 

Considering that even Microsoft would nowadays rather make ActiveX go away if they could, chances that NI even spends a single man hour to improve this (at the cost of runtime performance when calling ActiveX functions since the call interface has to be determined at runtime and adapted accordingly) is probably thinner than a tinfoil hat.

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 7
(948 Views)

Thanks for the reply!

 

So what's my solution? Do I have to install Excel 2019, uninstall LibreOffice and then recompile the EXE?

0 Kudos
Message 4 of 7
(914 Views)

When there is change in Excel Version, you need to rel-link the Invoke Properties and then build LabVIEW application.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 5 of 7
(903 Views)

@MvnStkkls wrote:

Thanks for the reply!

 

So what's my solution? Do I have to install Excel 2019, uninstall LibreOffice and then recompile the EXE?


Yes. It may be a good idea to look into Virtual Machines to maintain such multiple development environments.And there is a chance that the VI will load broken and you have to go into it to reselect the method.

Rolf Kalbermatter
My Blog
Message 6 of 7
(899 Views)

Thanks for the help.

 

Just for my understanding: If that is the only solution, then how can it be that the current EXE does work when moved to the project directory but does not work when I run it from the desktop? Shouldnt the error apper in both cases if the installed Excel version was the problem?

0 Kudos
Message 7 of 7
(891 Views)