LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

excel files deleted when not found

I am using the Report Generation toolkit for Microsoft Office. I have a vi that opens a template, renmaes it, saves it, and writes to an Excel file. The file is then saved again before the vi exits.

 

The problem is if the Excel file is accidently closed, then the vi closes and tries to save the excel file, it deletes the file that was saved. This seems to happen in the NI_Excel.lvclass:Save Report to File.vi, and comes up with error -2147417848 The first three case structures are false, which leads to the close and delete file subvis. I thought I could get remove the delete file vi, but I can not rename the subvi (...save report to file) to do this. This problem is causing me to lose product data.

 

How can I either make a copy of the sub vi, or prevent the subvi from deleteing the file if the file is not open?




metzler CLAD
0 Kudos
Message 1 of 2
(2,237 Views)

Hi metzler,

 

According to this KnowledgeBase Article: Close Microsoft Excel While Running Report Generation Toolkit it is recommended programming practice to catch and handle the resulting error if the user attempts to quit Microsoft Excel mid-execution.  In no way will NI recommend editing its shipping VIs.

 

I hope this helps!

 

- Greg J

0 Kudos
Message 2 of 2
(2,206 Views)