09-13-2013 04:09 PM
I have an application with a lot of excel functions going on using ActiveX. When I create a line to be added to the excel file it stays in memory but is not written immediately. When the LV app closes and uses close /save the file is written. I want to save each addition in the files in case the program crashes and does not exit gracefully. So that no data is lost.
Here is my function that adds each update to the excel file.
I thought the last activeX function would save the file each time I add something to the workbook.
It needs to update automatically without operator intervention.
Can someone tell me what I have wrong?
Thanks
Judd
09-16-2013 08:55 AM
Have you looked at the Excel Specific functions in the Report Generation menu?
09-16-2013 09:57 PM
No
Because I am using specific reads and writes to specific cell locations and variable cell locations I did not use the report functions. It may be dofficult to rewrite the code to use. them. What I do not understand is why a save does not change the file on disk unless it only saves to the temporary file until close. I am using booth the activeX save (workbook) which has no other functions/options and the close with save function true. The close saves as I want. The save seems to do nothing.
I don't want to close as there is the possibility someone else will try to read the file. When they dothey will open in edit mode which will force my program to re-open in read only mode which is not acceptable.
I will look at changing over to the report functions.
Thanks
Judd
09-16-2013 10:29 PM
Upload your VI in 2011 format.
09-17-2013 04:17 AM
Dear Judd,
You are using the correct function/method for save (Excel Workbook - Save).
Probably you check,
1. The sequence of the functions you are using
2. Error conditions,
3. Write Permission of the file
4. Write Protection/Properties of the Excel Cells
5. The Range you are using (Range of Cells)
Also I am suggesting to save the file before closing it (PFA).
Note that while debugging you can launch Excel Application with 'Visible' and put breakpoint before closing the excel file/or where you want.
So that you can cross-check that the write function is working properly.
09-17-2013 08:40 AM
When you exit the application, do you use Save or Save As? Could it be that, for your incremental saves, you haven't specified a directory to save in, but a directory is specified when you exit the application?
When I suggested the Report Generation vi's, I wasn't necessarily saying you should switch over to them. I guess you could if you want. But you can also plop those VIs down and view the code to see the proper way of saving something.
09-17-2013 06:34 PM
excel.llb has excel string write.vi which I have modified mostly to accept a 1D or 2D array. It does not save until I call
CloseWorkbook File.vi
09-18-2013 12:00 AM
I am uploading one VI.Just take a look at it. Let me know this you are looking for?