Private Sub Command1_Click()
Dim Buffer As String Dim Location As Single Dim Lenght As Single Dim ErrCount As Single Open "a:\FileGuasto.dat" For Binary As #1 'Nome del file danneggiato Open "c:\temp\FileRecover.dat" For Binary As #2 'Copia del file danneggiato Lenght = LOF(1) On Error Resume Next ' <---cosi Win non si blocca Buffer = Space(1) For Location = 1 To Lenght Get #1, Location, Buffer If Err <> 0 Then ErrCount = ErrCount + 1 Debug.Print "ERROR no.: " + Format$(ErrCount) + _ ".Impossibile leggere la locazione" _ + Format$(Location) Buffer = " " 'modifica il dato danneggiato con uno spazio Err.Clear ' azzera l'errore End If Put #2, Location, Buffer Next Close x = MsgBox("Fine") End 'Vai su c:\temp\FileRecover.dat" e cerca di aprire 'il file con Word, Excel, CDR, jpg, bmp, o altro End Sub |