Unable to write variable to file
I am not able to get the following code to write a variable to the file, I think it is just a syntax issue if I add text like "insert text to file" it will get printed to the file but I cannot get the variable syntax right.
Const TristateFalse = 0
Const FILE_NAME = "C:\Test.txt"
Set FSO = CreateObject ("Scripting.FileSystemObject")
Set objStream = FSO.CreateTextFile(FILE_NAME,True, TristateFalse)
Msgbox "Successfully created " & FILE_NAME & "."
That should work, could it be that your variable GetReqID doesn't have anything in it when it is written out, put a breakpoint in there and check the value in the Debug\Variables view.
As SteveRS said, If "GetReqID" have some value, it should work.
There is another way to do this is by using OpenTextFile:
fso.OpenTextFile(FILE_NAME, ForWriting, True)
You could write out a hard-coded string to verify the above points:
.WriteLine ("@@@ Test String @@@)