I would add a reference to Windows Scripting Host, then change everything to:
Code:
c1 = int(a1) xor int(b1)
linetowrite = linetowrite & chrw(c1)
Dim fso As New FileSystemObject
Dim f As TextStream
filed = app.path & "\aaa.txt"
Set f = fso.CreateTextFile(filed, True) ' The True is Overwrite.
f.Write linetowrite
This causes all of the methods and members to be typed so you can see more easily any problems.