LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read and delete excel file

Hi,
I've build a VI to read all sheets in an Excel file. It works well but when I'm using it in another VI and that I access the same Excel file, for example with the delete file VI, an error is generated. If the two VI are used separatly, no problem occurs.
I attach the VI I'm using to test the availability of the Excel file after the read operation is completed. The erasing of the file doesn't work, but some other actions can't be done too (save, etc.).
It seems as if an opened reference is not closed (even if I've tried to do to my best to close them all !)
 
I know the report generation toolkit exists but we don't have any money to spend in this solution that don't correspond to our needs.
I'd be grateful if someone could tell me what is going wrong in my VI, it's been a long time I've been trying and all my ideas failed for the moment...
 
Thank you in advance for your help.
 
Bim
0 Kudos
Message 1 of 5
(2,752 Views)
Ok, I believe it has to do with the reference to the excel application.  Even though the reference number is closed.  I got it to work fine by making your excel read portion a dynamic call.  The file read and deleted fine.  See example LV7.1.1

Paul
0 Kudos
Message 2 of 5
(2,737 Views)
What you shouldn't be doing is using the LabVIEW Open/Create/Replace File function at the beginning. Just use the Path to String to convert the path control to a string that the Workbooks:Open method needs. It is the Open/Create/Replace function that is holding the file open and preventing you from deleting it. There is no need for both Excel and LabVIEW to open the file.
0 Kudos
Message 3 of 5
(2,736 Views)

True that, I glossed right over that part and was concentrating on the methods. 

I guess always check the plug...

 


Paul
0 Kudos
Message 4 of 5
(2,735 Views)

That was it !

I developped this VI a few time ago and I forgot I managed the open file like this.

Thank you all for your help!

 

0 Kudos
Message 5 of 5
(2,701 Views)