View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Petr Bazant Petr Bazant is offline
external usenet poster
 
Posts: 3
Default VBA, Reading File As Binary

I needed to change Unix EndOfLine style "only CR" to Win style "LFCR"
so I tried to run following code in VBA:

Sub Modification()
Dim ff1, ff2 As Byte
ff1 = FreeFile
ff2 = FreeFile + 1
Dim a, b As Double
Open "original.csv" For Binary As #ff1
Open "modified.csv" For Binary As #ff2

Do Until EOF(ff1)
Get #ff1, , a
If a = 10 Then
b = 13
Put #ff2, , b
End If
Put #ff2, , a
Loop
Close
End Sub

but when it gets to Get command it says "Run-time error 458, Variable
uses an Automation type not supported in Visual Basic". Can someone,
please, help me.