
Sub import()
Dim my_file As String, s As String, fso As Object, f As Object
my_file = "path & filename here.txt" ' <-- qui inserire il percorso e nome di file da cui leggere i dati
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(my_file, 1, False) '1 = ForReading
s = Replace(f.readall, Chr(10) + Chr(13) + Chr(10), vbCrLf)
f.Close
Open "path & est2.txt" For Output As #1 ' <-- qui inserire un percorso e nome di file di testo di prova
Print #1, s
Close #1
MsgBox "Fatto."
End Sub |
Sub import()
Dim my_file As String, s As String, fso As Object, f As Object
my_file = "path & filename here.txt" ' <-- qui inserire il percorso e nome di file da cui leggere i dati
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(my_file, 1, False) '1 = ForReading
Open "path & est2.txt" For Output As #1 ' <-- qui inserire un percorso e nome di file di testo di prova
Do While f.AtEndOfStream <> True
s = f.ReadLine
If Trim(s) <> "" Then Print #1, Replace(s, Chr(10) + Chr(13) + Chr(10), vbCrLf)
Loop
f.Close
Close #1
MsgBox "Fatto."
End Sub |
Sub EliminaLF()
Dim Fname, FN$, Data$
Dim count£
Dim T1 As Date
Data = Chr(32)
Debug.Print "-Start "; Data; Time; " -"
Close
Fname = Application.GetOpenFilename()
If Fname = False Then Exit Sub
FN = Fname & "-SENZA-LF-.ped"
T1 = Time
Open Fname For Binary Access Read As #1
Open FN For Binary Access Write As #2
Do Until EOF(1)
Get #1, , Data
If Data = Chr(10) Then
Data = Chr(13)
count = count + 1
End If
'Debug.Print Data; Asc(Data)
Put #2, , Data
Loop
Close
Debug.Print Durata(T1, Time), count
Debug.Print "-end-"
End Sub |
