09-29-2009 11:10 AM
I finished my program with Excel communication. It works fine but when the program close XL, this one send a saving confirmation, I would like to save all changes automatically without that confirmation
I tried with an invoke node with method SaveAs but it sends that confirmation and with Close but that doesnt work it appears Error #97
I would appreciate any help !
Thanks in advance !
Solved! Go to Solution.
09-29-2009 11:48 AM
If you are controlling Excel from within LabVIEW, you need to use ActiveX.
The solution would be to save before you exit the application.
There's an Excel thread somewhere which discusses all this. I'll look for it.
R
09-29-2009 11:58 AM
Have a look at this thread:
http://forums.ni.com/ni/board/message?board.id=BreakPoint&message.id=2391#M2391
09-29-2009 12:08 PM - edited 09-29-2009 12:10 PM
Hello Ray. R thanks for your reply, well I'm using ActiveX with my program. I attach one of the examples that i try to do, where can i save all changes i did and how ?
I try first to make it and probe it before i attach to my program
Thanks for your help !
09-29-2009 02:48 PM - edited 09-29-2009 02:49 PM
I think you need not to close the Workbook reference and use it later to wire it to a function node (?) in order to be able to select "Save". It might be a property node. Unfortunately, I'll have to dig up some old code tonight and refresh my memory. I do believe it is the Workbook reference and not the worsheets.
Excel is both fun & interesting when you first work with it in LabVIEW. You're doing fine and close to the solution.
Another piece of advice. Wire the error clusters between the functions. It is a good practice to do so and may save you some headaches in the future.
R
09-29-2009 03:32 PM
10-02-2009 07:46 AM - edited 10-02-2009 07:52 AM
Its a good practice to close all references once they have no further use, and you are closing all references ...but before you are done with your use.
Here is the explanation with respect to your snapshot:
1] You close the reference to Application before you use the open method: The Application reference is that of MS Excel Application, so when you close the reference, you actually did an exit operation for MS Excel. If MS Excel application is no longer alive then no further meaning for any of the operations you are performing. *You should close Application (MS Excel) reference when you are done with all operations that you perform on that application, meaning last*
Similarly ....
2] Workbooks reference, can say that this stores reference to all opened Files, hence should be closed second last, before Application.
3] Sheets reference, can say that this stores references of all worksheets in a single workbook or file, hence should be closed third last, before Workbooks reference.
4] Worksheet reference is a reference to an individual worksheet in an Excel File, and hence should be closed when you are done with that worksheet. Say you are working with Sheet1, Sheet2, and Sheet3 in Excel. Each sheet has its individual Worksheet reference. So when you are done with Sheet1, you close reference to Sheet1, and so on.
5] Range reference is basically a reference to a collection (or group) of cells in a particular worksheet (Same worksheet of which it takes the reference), so you close the reference to range once you are done editing/updating or whatever action you intend to do with that selection (aka Range).
Hope this helps?
10-02-2009 10:39 AM
Thanks man I understood better about active X controls finally i did a few changes and i able to write and the search what i need
thank you