08-30-2018 11:50 AM - edited 08-31-2018 01:14 PM
Hi,
My LabVIEW program is writing approximately 20 cells to an Excel file via XLR8 around every 30 seconds. After approximately 40 minutes the following normally happens...
If I rename the .bak file to .xlsx it opens normally with Excel, so the backup file is not corrupted.
Sometimes LabVIEW does not crash and XLR8 generates the following error...
"Error 1172 occurred at Invoke Node System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
Inner Exception: System.NullReferenceException: Object reference not set to an instance of an object."
I am running LabVIEW base version 15 and XLR8 v2018.3.0.7
Any help or suggestions on resolving this issue would be greatly appreciated.
Thank you very much
Aaron
08-31-2018 04:07 AM
Update.
My code initially opens an Excel template and saves it to a new path and filename using a modified version of the example vi "exmpl_WR_template_results.vi".
I noticed that the file refs between opening the template file and closing the template file are different (the Refs is changed by the 'Save Workbook.vi'). Please see probes 6 and 7 on the attached screen shot.
Is this correct ? Should the 'Open Create Workbook' Refs Out be connected to the 'Close Workbook' Refs In ?
Thank you very much
Aaron
09-03-2018 02:12 AM
UPDATE :
I have discovered the 'Refs Out' WBK field from the 'Open Create Workbook.vi' is sometimes zero even though the file exists and has been opened successfully by a previous call to the 'Open Create Workbook.vi'.
My Excel file is saved on a VeraCript drive. Could this cause a problem ?
Thank you.
Aaron
09-04-2018 09:19 AM
Hi Aaron,
as stated in https://forums.ni.com/t5/DATA-AHEAD-toolkit-support/XLR8-Which-Refs-to-use-for-Close-Workbook-when-u... the VI "Save Workbook.vi" will close the changed template file and after that re-open the new file again. So the change of Refnums is expected.
I am not familiar with VeraCrypt Drives but it might be possible that the creation of the file on such a encrypted drive takes a little bit longer and hence the re-opening of the new file results in an error and empty refnums.
A solution to your problem might be another approach:
Why not copy your your template excel-file to the new file-name, using basic LabVIEW-functions, and then open that copied file, write to it and close and save it with just a call of "Close Workbook.vi".
Regards,
DATA AHEAD
09-04-2018 09:33 AM
Hi Jens,
Thanks for your reply and suggestion. I have a work around for now, I'm not sure which of the following helps but most likely is the change from an encrypted to un-encrypted drive...
Best regards
Aaron