Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text File (I dont need the additional last line) 1

Status
Not open for further replies.

suoirotciv

Programmer
Dec 3, 2002
205
PH
Good day,

The given code below is working.

But my problem is when i open the text file and go to the last line, there was additional row instead of showing only the "SetFooter". It was like I hit the enter key.

How can I avoid that last line.

======= SAMPLE ONLY (MY PROBLEM) ========
01234567891
01234567892
01234567893
9876543210

===================================

======= SAMPLE ONLY (SHOULD BE) =========
01234567891
01234567892
01234567893
9876543210
===================================

Code:
Dim NewTextFile As Object, fso As Object
Dim TextFileName As String
Dim SetFooter As String
Dim SetDetails As String

Dim LoopRec as Integer

Const ForWriting = 2

Set fso = CreateObject("Scripting.FileSystemObject")
Set NewTextFile = fso.OpenTextFile(TextFileName, ForWriting, True)

For LoopRec = 1 to 3
   SetDetails = "0123456789" & LoopRec
   NewTextFile.writeline SetDetails
Next LoopRec

SetFooter = "9876543210"
NewTextFile.writeline SetFooter

========================================
I kept my Job because of TEK-TIPS
Thanks a lot to all who keeps on helping others.
 
Thanks a lot.

That was great.

========================================
I kept my Job because of TEK-TIPS
Thanks a lot to all who keeps on helping others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top