I would like to edit a .dtf (IBM Data Transfer file) via VBA. Opening it in excel is causing me problems so I was hoping to read the file line-by-line and export to a new .dtf. However something goes wrong when I try to Print #1
the string to the .dtf
Sub test()
Dim TemplateFilePath As String
TemplateFilePath = "C:\TemplateFile.dtf"
Call CreateDataTranderFile(TemplateFilePath)
End Sub
Public Sub CreateDataTranderFile(TemplateFilePath As String)
Dim output As String
Dim OutFullPath As String
Dim Line As String
Dim FileNum As Integer
OutFullPath = "C:\tmpTranferfile.dtf"
'Read from template
FileNum = FreeFile()
Open TemplateFilePath For Input As #FileNum
While Not EOF(FileNum)
Line Input #FileNum, Line
output = output & Line
Wend
Close #FileNum
'Write .dtf
Open OutFullPath For Output As #1
Print #1, output
Close
End Sub