Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

close excel without saving on user file cancel

Greetings all. 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 2
(3,286 Views)

Hi Franco,

 

I have a VI (attached, version 7.1) that calls the close method you are describing.  The state(s) you want to look at are part of what I call the "shut down routine".  This routine is called when an error occurs, or the user presses stop.  They are state(s) 90-99 in the VI

 

Let me know if you have any problems with the VI, or if this doesn't answer your question.

 

Joel

0 Kudos
Message 2 of 2
(3,278 Views)