You probably dont have permission to create the file in that directory. Try this:
code:
theFile = fso.OpenTextFile(MsgPlus.ScriptFilesPath + "/data.txt", ForAppending, true);
The MsgPlus:: ScriptFilesPath property returns the full path to the current script's files.