From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView .exe opens and closes excel before data can be written

Solved!
Go to solution

I am brand new to lab view and new to this forum as well. I am hoping my issue is an easy fix or work around.

 

When I click the icon to begin to run the portion of code that logs all my sensor data into excel, the program opens and closes excel rapidly. I run into an issue ONLY when I try to run the data logger from the .exe build. When testing everything in the .vi, the data logger runs exactly as it is supposed to. Excel opens, formats the fields appropriately, then when I click the button to turn off the data logger it saves the excel document in the appropriate place.

 

We have an older version of labview code that the data logger works perfectly fine from the .exe. When I copy this build profile but substitute the new .vi - I get the same excel error. When I use the exact same .vi and rebuild from the old project - I get the same excel error.

 

I am running lab view 14. Excel 2013 is installed on the machine.

 

Attached is the .vi I have been working on.

 

There is no antivirus stopping me, that I know of.

Please help. 

0 Kudos
Message 1 of 8
(2,487 Views)

Dear lord that's a lot of parallel While loops.

 

I'm going to assume your problem is with this bit here:Capture.PNG

The two VIs on the end are in the NI library, but the 2 and the front and the one in the loop aren't.  You might need to show us those, but since the loop stops when an error occurs it's probably not an issue with those VIs.

 

The one thing I immediately note is that there is no error handler on the end of the chain there.  Your VI has "automatic error handling" enabled, which gives you popup errors during runtime when in LabVIEW, but does nothing when in an EXE.  I'd bet that you're getting an error there, and it's just not popping up.  Add an error handler at the end of that chain (just "Simple error handler" from the "Dialog and user interface" palette is enough), rebuild the EXE, and try again, and I bet an error will come through.

 

 

0 Kudos
Message 2 of 8
(2,437 Views)

Most of the functions you use to create an Excel file do not appear to be part of the Report Generation Toolkit.  What are the functions that you used, "ReportCreate.vi", "CreateReportTitles.vi", and "ReportWriteRow"?  I'd guess that they might be faulty.

 

Also you are using old versions of LabVIEW and old versions of Excel.  Giiven the unknowns in this situation, I'd recommend writing a small Demo routine that does a Create Report, writes some data to an Excel file, saves the file, then disposes (of) the Report.

 

Once you do this, see if your test routine also shows the same problem.  If it does, post it, along with all of the functions named above so we can try to help you "find the bug".

 

Bob Schor

0 Kudos
Message 3 of 8
(2,427 Views)

Yes, it is a lot of while loops. 

 

I get an error code when running the .vi code

Error 1073807343 occorred at Property Node (arg 1) in Serial Shared Components.lvlib:  Configure Serial Port.vi -> Serial Master.lvclass:  Initialize Master.vi -> Modbus Master.lvclass:  Initialize.vi -> API Main.lvlib:  Create Serial Master.vi -> Daq Main v3 AM Edits.vi 

 

Am I missing some drivers? If so, I find this odd as the original bits of code have this and do not throw any errors.

0 Kudos
Message 4 of 8
(2,385 Views)

After adding the error handling I get the error:

 

Error 7 occurred at NI_Excel.lvclass:new reportsubVI.vi -> NI_report.lvclass:New Report.vi -> ReportCreate.vi -> Daq Main v3AmEdits.vi

 

File not found.

 

This file is in the project folder that the DaqMainV3.vi is built from.

0 Kudos
Message 5 of 8
(2,377 Views)
Solution
Accepted by topic author AndrewM123

Error 7 is file not found, so it can't find the file or it's got some sort of denied permissions on the file, but it's more likely just looking for the file in the wrong place as error 8 is permissions problems usually.

 

According to the code of the SubVI, it's going to look for "TestFacilityTemplate.xlt" in the "data" subfolder of the folder the application is in.  So if your EXE is at "c:\Application\DAQ.exe", it should be looking for "c:\Application\data\TestFacilityTemplate.xlt".  Is that file located there?

Message 6 of 8
(2,369 Views)

Yes. 

 

The application.exe is in the ...\builds\2-8-2020 folder

 

TestFacilityTemplate.xlt is located in ...\builds\2-8-2020\data

0 Kudos
Message 7 of 8
(2,366 Views)

I deleted everything in the folder, recreated the excel document, rebuilt the application.

 

Fixed it.

 

Thank you so much for your support. Now that I have solved this problem I am going to start on the tutorials.

0 Kudos
Message 8 of 8
(2,361 Views)