LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

close excel programmatically after user cancels file selection

Greetings all. I apologize but I incorrectly posted this question on the wrong board originally so am posting it again here. I have a VI that I wrote with some help from this site that reads in as many user selected Flat Data Files as desired into Excel. The VI opens Excel, places each Flat Data File on one row and ends, allowing the user to manipulate the Excel data as desired. I have tested it without problems with up to 100 files at a time. The VI minimizes Excel at startup so that it will not block the Select File(s) dialogue. MY problem is this: If the user cancels the file selection, it returns an error and leaves Excel open. I understand how to handle the error, but have been unable to make Excel close automatically if the action is canceled. I have tried to invoke the Close without saving node with no luck... probably because I don't understand how to apply it. Ideally, I want to take the error number to a case statement, and if it is anything other than zero (0), meaning no error, I want Excel to close down. This will eventually be an executable so I need to make this right. Can anybody help? I have attached a zip file with the VI's and some sample Flat Data Files.
 
Thanks
0 Kudos
Message 1 of 4
(2,720 Views)
If you want anything to run after an error you must clear the error status boolean from the error cluster. To do this use the bundle by name and set the status value to FALSE, take this output cluster into the function you wish to run.
Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
0 Kudos
Message 2 of 4
(2,711 Views)

Hi

I understand about clearing the error cluster. My problem is figuring out how to close Excel if an error occurs. I just can't get the invoke node to work properly I guess. I want to close the application if the user cancels file selection, since the application opens at the start of the VI, minimizes itself, then allows the user to select the files to import.

0 Kudos
Message 3 of 4
(2,707 Views)
Where is the File Dialog Wrapper.dll file? Did you create this?
Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com
0 Kudos
Message 4 of 4
(2,696 Views)