Apart from the (real) possibility that they (PTC) didn't think that users would actually want to use WRITETEXT in a program (nothing in the help files indicates, let alone describes how, you could use it in a program):
I see no error (message) in the picture you provided. Please provide (also) a worksheet.
You only defined the 'check' variable in terms of a (little) program.
In order to actually execute the WRITETEXT function in that little program, it must be evaluated. Did you try evaluating check yet?
To evaluate check type:
Did you save the worksheet that contains this? Did you check the contents of the directory where it is saved to (should be equal to what
And do you have sufficient rights to create a file in the directory that CWD points to?
I'll post the whole testfile once again.
The file contains 2 files that should be written. The first one is written regardless of the check, and it actually is in the folder.
The other one in the program is not written, though it should be in the same folder.
WRITETEXT does not recover data from a file, for that you need READTEXT. I'm not sure what your check routine is supposed to do. Try the example from the help files:
No, we're just talking about writing to files.
The problem is, that I haven't managed to write to file if the code is in a program component.