title: Converting Dos Text Files to Unix in VBA fails
body: <p>I've followed the suggestion in a prior question and grabbed this code but I don't get a useable file out of it. I've looked at it and don't see the problem.</p>
  
  <pre><code>    Public Enum ConvertType
  dos2unix = 0
  unix2dos = 1
      End Enum
  
      Public Function ConvertFile(OriginalFile As String, NewFile As String, eConvertType As ConvertType, _
                          Optional DeleteOriginal As Boolean = False)
  
  Dim OpenFileNum, SaveFileNum As Integer
  Dim NewFileBuffer As String
  
  
  ' This function will open a file and convert it to
  ' a txt file format usable under *nix or dos
  On Error GoTo Error_Found
  
  OpenFileNum = FreeFile ' grab the first free file
  Open OriginalFile For Input As #OpenFileNum ' open the unix file
      SaveFileNum = FreeFile ' get another free file to write to
      Open NewFile For Binary As #SaveFileNum ' open/create the save file
          Do While Not EOF(OpenFileNum)
              Line Input #OpenFileNum, NewFileBuffer ' retrive the text (if a unix file, then the entire text is on one line)
              If eConvertType = dos2unix Then ' Check what type of conversion to do
                  NewFileBuffer = NewFileBuffer &amp; Chr(10)
              Else
                  NewFileBuffer = Replace(NewFileBuffer, Chr(10), vbCrLf)
              End If
              Put #SaveFileNum, , NewFileBuffer ' write out the file
          Loop
      Close #SaveFileNum
  Close #OpenFileNum
  
  If DeleteOriginal = True Then Kill OriginalFile
  
      Exit_Sub:
      Exit Function
  </code></pre>