LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can not save excel file when dispose excel because the file is read-only. How can I do it?

I can not save an excel file generated by report generation toolkit in LV becaues it is a read-only file. How can I generate a un-read-only file?

Thanks.
0 Kudos
Message 1 of 4
(3,329 Views)
Is my question clear enough?

What I want to do are:
1. create or open a file in LV (use Open/create/replace File.vi), generate a new report, write data to the report, save report to file before dispose it.

2. use subvi to enter file's path and name, don't use labview's file dialog box or Excel's menu because we are using touch screen and they are not big enough for fingers.

What I encountered are:
got error message after Save Report to File.vi function, which is "Error -2146827284 occurred at Exception occured in Microsoft Office Excel, Cannot access read-only document 'file name'.. Help Path is C:\Program Files\Microsoft Office\OFFICE11\1033\xlmain11.chm and context 0 in Excel_Save_Workbook.vi->Save Report to File.vi
This error code is undefined. No on
e has provided a description for this code, or you might have wired a number that is not an error code to the error code input."

2.Excel open and I can see the data was written in it, after a few seconds later , got message from Excel which is "File Now available.
'file name' now available for editing, please select read/write for editing." something like that.

3. the data is written to Excel, but not saved before dispose report. so when reopen that file from excel, it is empty.

Does anyone know how to figure it out?

Thanks.
0 Kudos
Message 2 of 4
(3,329 Views)
Hi,

I am not sure how you want to enter the file path and name. Are you using it as a control or constant?

Also, I tried to create a report, write a table to it and I was able to save and dispose it without any problem.

It would be helpful if you could post a simplified part of your code on the forum so I could get a better idea of what's going on.

Regards,
Ankita A.
0 Kudos
Message 3 of 4
(3,329 Views)
Thanks Ankita.

I got the problem solved. Actually, I have to leave the template path (file name input of New Report.vi) empty, and give the file name at the point of Save Report to File.vi.
It is related to my another question "how can I creat or open an excel file in labview?"

Thanks anyway.
0 Kudos
Message 4 of 4
(3,328 Views)