LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving changes without Excel confirmation

Solved!
Go to solution

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 !

0 Kudos
Message 1 of 8
(5,198 Views)

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

0 Kudos
Message 2 of 8
(5,184 Views)
0 Kudos
Message 3 of 8
(5,179 Views)

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 !

Message Edited by juiop on 09-29-2009 12:10 PM
0 Kudos
Message 4 of 8
(5,175 Views)

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

Message Edited by Ray.R on 09-29-2009 03:49 PM
Message 5 of 8
(5,150 Views)
You should open the Example Finder (Help -> Find Examples), search for "excel", and open the example called "Write Table to XL". That shows you how you can save a workbook by calling the Close method. In your case you would wire a True constant to the "SaveChanges" input.
Message 6 of 8
(5,142 Views)
Solution
Accepted by topic author juiop

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?

Message Edited by Imagineer on 10-02-2009 07:47 AM
Message Edited by Imagineer on 10-02-2009 07:52 AM
0 Kudos
Message 7 of 8
(5,087 Views)

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

0 Kudos
Message 8 of 8
(5,069 Views)