
Originally Posted by
DeanM
TestDate = Now
FilePath = "C:\xyz"
FileName = Box + ", " + TestDate + ".txt"
filelocation = FilePath + FileName
Open filelocation For Append As #1
Print #1, Text1.Text
Close #1
[/CODE]
Like Rhinobull said, format the date before using it. And I assume you want the complete one. I think this should do it:
Code:
TestDate = Format(Now, "Long Date")
And I believe this one would raise an error:
Code:
Open filelocation For Append As #1
Print #1, Text1.Text
Close #1
It is because of the line filelocation = FilePath + FileName. <Look here.. FilePath = "C:\xyz", FileName = Box + ", " + TestDate + ".txt"
Supposing that Box is "K5" and TestDate is "15-06-10 4-25 PM" (as Spoo recommended) then FileName would be "K5, 15-06-10 4-25 PM.txt"
Now FilePath + FileName would be "C:\xyzK5, 15-06-10 4-25 PM.txt" which will result to error or to an unexpected path and file name.
Maybe you mean
Code:
filelocation = FilePath + "\" + FileName
Lastly, I would recommend using "&" instead of "+" in connecting strings.