Hi
You probably need to handle the last loop differently.. So after initiaing the loop:
If r = ubound(arr)
Exit for
End If
(This little snippet will exit the loop at the last iteration, thus preventing the last line to be generated). If you notice that you are missing last row of data, then you will need file.writeline join(worksheetfunction.indext(arr, r), vbTab) within the IF, before the exit for.
Best regards
Chris