LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

RGT and Excel - Workbook deleted?

Has anyone experienced Excel workbooks disappearing when LabVIEW is left up?

 

The scenario is that users are locking the Windows PC and walking away from it either going for break or leaving for some time only to return to find their workbook has been deleted. I though that a backup was being performed on it (twice a day - 7:00 AM and again at 12:00 PM) and that was causing issues but I can't confirm or deny that is happening when the the workbook is left open.

 

Looking at my code, I can't find anywhere where LabVIEW would be getting triggered and deleting the Workbook. Is the Report Generation Toolkit (Excel) losing it's reference and then all bets are off on what it does? Really looking for ideas and I have ran out of them.

0 Kudos
Message 1 of 4
(795 Views)

I have a vague recollection of experiencing something like this 10 years ago...

I recall something funny happening if you access a workbook manually that LabVIEW has an active reference open to.. or open a reference to an open workbook and modify it. I think it's an Excel thing.
Basically, don't ever open a workbook that has any posibility of being opened. (and then maybe not even open on the same machine unless you want to mess with the automation.)
Best practice seemed to be to create the Excel file, edit it. then archive it to a totally different folder when completed and no more LabVIEW transactions are going to take place.
If you want to look at the files while LV is running, archive to the network and look at it from another PC.

You'll probably find that the reference is being closed in LV, the file has left memory and the user has the WB open (until the machine locks at which point it throws the other (Windows/Excel) reference as the file has already moved or been closed.

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 2 of 4
(773 Views)

I've also used the RGT for logging results, but they were for saving data from psychophysical studies on human subjects which lasted about an hour and no-one "walked away and left the code running".  But if memory serves, I think we may have periodically closed the Excel file, waited a second, and then re-opened it "just in case" something went wrong somewhere in the Program, so we didn't lose all the data that was still in memory but not yet written to the Spreadsheet.  We found that the RGT was pretty good at opening and closing Excel Workbooks -- depending on what your code does and if there are stretches where Excel I/O is not taking place, keeping an updated copy of the data might be a good idea.  I'd combine this with James_W's suggestion of periodically writing a "Copy of the Data So Far" file (and closing it) so if a crash does occur, you only need to rename the "Last Good Copy".

 

Bob Schor

 

 

0 Kudos
Message 3 of 4
(719 Views)

Bob/James:

 

I suspected, like both of you, that no reads/writes were happening so the PC closes the connection unsuspectedly.. I'll make a change and use Queues to pass the data and, at the very least, open and close (save) the data. Thanks for your insight.

 

Eric

0 Kudos
Message 4 of 4
(704 Views)