From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-06-2016 05:44 AM
Hello everyone!
I have a problem. I build an application who save, when i press a button, a doc file with some data. I use for that "NI-Report generation..save report to file". When i press the button for the first time the app create the file in directory (C:/program files/myapp/data) but then, when i press the button again the app give me an error : "Exception occured in Microsoft Word: the file is read - only."
But if i close the program and start the program again and then press the button , this error NOT occur; but if i press the button again the error will occur.
Thank you for your time!
Marius
04-06-2016 05:51 AM
Hello Marius,
without seeing your code it is hard to say what is going on.
Just a guess: Did you call 'Dispose Report.vi'?
UliB
04-06-2016 06:02 AM
Hi Ulib!
I attash the file with the code .That error occur after install app. Before , in the labview project, this error is not occur.
Thank you!
04-06-2016 06:23 AM
Hi Marius,
The Problem with the code is that for the first time when you click you will get the document and it will be in open state. So next time when you click the vi cannot update the document so you are getting this error. just follow the steps
1) In the Dispose Report function wire the Close Report?T Terminal to True. this will solve the issue .
I have also attached the vi snippet for your reference.
Kudos are Welcome 😄
04-06-2016 06:39 AM
Hi Joel!
I do that as you say but isn't work. by default this wire is True, no?
Thank you.
04-06-2016 07:16 AM
Hi Marius,
Can you tell me whether you want to overwrite the existing file or you want to replace???
04-06-2016 07:32 AM
Hy Joel!
I want to replace this file!
Thank you
04-06-2016 07:54 AM
Hi Marius,
Make this small change in your code and it will work. add a delete function so that you wont get the error again
Hope this works 🙂
04-06-2016 08:33 AM - edited 04-06-2016 08:36 AM
@marius.lucian wrote:Hello everyone!
I have a problem. I build an application who save, when i press a button, a doc file with some data. I use for that "NI-Report generation..save report to file". When i press the button for the first time the app create the file in directory (C:/program files/myapp/data) but then, when i press the button again the app give me an error : "Exception occured in Microsoft Word: the file is read - only."
But if i close the program and start the program again and then press the button , this error NOT occur; but if i press the button again the error will occur.
Thank you for your time!
Marius
The issue might be Windows permissions because you are editing a file located in C:\Program Files. The first time it work because you are creating the file not editing it. Right-click on your data folder and check the security properties to see if the user has the modify rights.
edit: Even if it is not the cause I would recommend you save your data file somewhere else.
Ben64
04-06-2016 09:33 AM
Hy Joel: I tried it but did not work.:(
Hello Ben
I open app in run as administrator, the first time create a file and after the file have permissions:
All application packages : read& execute and Read are checked.
System : there are all of them checked: full control, modify,read&execute,read,write,special permissions
Administrators: idem SYSTEM
Users : Idem All application packages.
There are all permissions for that file.
I tried to find a method to set permissions to the file, but it didn't work.(set permissions function).
If i start the app in Administrator mode, i should have the administrator permissions, so...?
Thank you.