Now i need to insert in position 133 of each line processed the digit "|"... when the code wirte into new txt file
i have maked this code, but...????!!!!
Code: Select all
Sub MAIN()
On Error GoTo ExitHandler
Dim intUnitIn As Integer
Dim intUnitOut As Integer
Dim strBuf As String, Y As Long
Dim strFilename As String
Dim strNewFilename As String
Close intUnitIn
Close intUnitOut
strFilename = "C:\TEMP\TABULATI.TXT"
strNewFilename = "C:\TEMP\TABULATI_132.TXT"
intUnitIn = FreeFile
Open strFilename For Input As #intUnitIn
intUnitOut = FreeFile
Open strNewFilename For Output As #intUnitOut
Do While Not EOF(intUnitIn)
Line Input #intUnitIn, strBuf
If Not strBuf = "" And Trim$(strBuf) <> "" Then
Do While Len(strBuf) > 132
Print #intUnitOut, Left(strBuf, 132) & "|"
strBuf = Mid(strBuf, 133)
Loop
Debug.Print Len(strBuf)
Y = 132 - Len(strBuf)
'Debug.Print "DIFF " & Y
Print #intUnitOut, strBuf
'Debug.Print strBuf
End If
Loop
Close intUnitIn
Close intUnitOut
Exit Sub
ExitHandler:
Close intUnitIn
Close intUnitOut
MsgBox Err.Description, vbExclamation
End Sub
result:
sdfsdsdsdsdf |<position 133
jhgh |<position 133
i think not is for me