Hi,
We have lots of issues with carriage returns appearing in our consolidation import files (of which we have 15-20) so I created a scrubbing program using a macro, but the file it creates is missing something and I can't figure out what. Here's the loop:
Option Explicit
Public objFSO As Object
Public objFileFrom As Object
Public objFileTo As Object
Private Sub Initialize()
Dim strTemp As String
Dim strLineTo As String
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFileFrom = objFSO.OpenTextFile("H:\sage\Consolidation Scrubber\Sample File\INFILE.001", 1)
Set objFileTo = objFSO.CreateTextFile("H:\sage\Consolidation Scrubber\Sample File\OUTFILE.001", 1)
Do Until objFileFrom.AtEndOfStream
strLineTo = objFileFrom.ReadLine
If Mid(strLineTo, 2, 1) = 2 Then
If Len(strLineTo) < 383 Then
Do
strTemp = objFileFrom.ReadLine
strLineTo = strLineTo & strTemp
Loop While Len(strLineTo) < 381
End If
End If
objFileTo.WriteLine strLineTo
Loop
objFileFrom.Close
objFileTo.Close
End Sub
When I open the OUTFILE.001 up in a file editor like Notepad++ (I actually use Geany) it looks to be in the correct format and it will be brought in to the consolidation import screen, but when I click Import is says no records are found.
I uploaded the first record I'm working with to see if anyone can tell me what I'm missing?
Thanks!
We have lots of issues with carriage returns appearing in our consolidation import files (of which we have 15-20) so I created a scrubbing program using a macro, but the file it creates is missing something and I can't figure out what. Here's the loop:
Option Explicit
Public objFSO As Object
Public objFileFrom As Object
Public objFileTo As Object
Private Sub Initialize()
Dim strTemp As String
Dim strLineTo As String
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFileFrom = objFSO.OpenTextFile("H:\sage\Consolidation Scrubber\Sample File\INFILE.001", 1)
Set objFileTo = objFSO.CreateTextFile("H:\sage\Consolidation Scrubber\Sample File\OUTFILE.001", 1)
Do Until objFileFrom.AtEndOfStream
strLineTo = objFileFrom.ReadLine
If Mid(strLineTo, 2, 1) = 2 Then
If Len(strLineTo) < 383 Then
Do
strTemp = objFileFrom.ReadLine
strLineTo = strLineTo & strTemp
Loop While Len(strLineTo) < 381
End If
End If
objFileTo.WriteLine strLineTo
Loop
objFileFrom.Close
objFileTo.Close
End Sub
When I open the OUTFILE.001 up in a file editor like Notepad++ (I actually use Geany) it looks to be in the correct format and it will be brought in to the consolidation import screen, but when I click Import is says no records are found.
I uploaded the first record I'm working with to see if anyone can tell me what I'm missing?
Thanks!