10-19-2006 07:49 AM
10-19-2006 09:08 AM
10-19-2006 11:44 AM
More details:
The vi which creates the Excel spreadsheet leaves it (and Excel) open after it completes. When you run the vi again, but forgot to close Excel or the spreadsheet, it generates an error when trying to delete it, because the file is in use. I thought of putting a popup message if an error is detected to close the spreadsheet and try again.
Is there a way to confirm that a file or application (Excel) is open and to close it?
10-19-2006 11:47 AM
hi,
If you are using a loop to run your program..You can put this code after the while loop so that every time after the code completes it closes the Excel and the worksheet for sure.
Hope it helps. let me know if you need an example for doing it.
Regards
10-19-2006 11:49 AM
10-19-2006 02:07 PM
No can do.
Let's keep it simple: Is there a way to confirm that an application (Excel) or file is open?
10-19-2006 02:52 PM
Well I dont know if you can find out if a file is already open or not.
But you can definitely close one which is open.
Did you tried doing what i told you in Reply 4 . Put the code in the end of the program
All you need is to wire a reference from your excel workbook . i have attached a small program getting the Print preview of an excel document. It is closing excel afterwards.
You can try inserting your own code inro it.
Also in the initial filename for book , select path of any excel sheet on your computer before starting.
Let me know if you face any difficulty.
Can you attach a print screen of your code. It can help me understand your problem better.
Regards
10-20-2006 08:42 AM
10-20-2006 09:43 AM
You could use the windows API. There are some VI's that you can download and unzip to your user folder that will do some windows API functions. One of the VI's will get a list of running apps from windows task manager (Get Task List.vi). You can then close the app that you want.
10-20-2006 10:03 AM - edited 10-20-2006 10:03 AM
Message Edited by paulmw on 10-20-2006 10:03 AM