I needed to do the same thing. This seems to do the trick:
Sub StripNulls(strFileIn As String, strFileOut As String)
Dim iFileIn As Integer
Dim iFileOut As Integer
Dim strChar As String
iFileIn = FreeFile
Open strFileIn For Binary As iFileIn
iFileOut = FreeFile
Open strFileOut For Binary As iFileOut
Do Until EOF(iFileIn)
strChar = Input(1, #iFileIn)
If strChar = Chr(0) Then
strChar = " "
End If
Put #iFileOut, , strChar
Loop
Close iFileIn
Close iFileOut
End Sub
I think if you replaced your If statement with the following, yours
might work:
Dim byt as Byte
If (fs.FileExists(strOldFile)) Then
Open strOldFile For Binary As #1
fileLength = LOF(1)
Open strNewFile For Binary As #2
For i = 1 To fileLength
Get #1, i, byt
If (byt = &H0) Then
byt = &H20
End If
Put #2, , byt
Next i
Close #1
Close #2
Else
MsgBox "I do not have a valid path for the input file that was
downloaded from the mainframe. Please provide a valid path!"
End If