01-12-2022 09:46 AM - edited 01-12-2022 09:47 AM
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.
01-12-2022 10:36 AM
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
01-13-2022 06:17 AM
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
01-13-2022 07:40 AM
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