Ok, forse ci son riuscito, ora ho solo qualche problema di formattazione, ho fatto così:
codice:
Private Sub Form_Load()
MSComm1.CommPort = 1
MSComm1.Settings = "19200,n,8,1"
MSComm1.RThreshold = 1
MSComm1.PortOpen = True
End Sub
Private Sub MSComm1_OnComm()
Dim Ricevi
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FileExists(App.Path & "\Archivio.txt") Then
fso.CreateTextFile App.Path & "\Archivio.txt"
Set f = fso.OpenTextFile(App.Path & "\Archivio.txt", 2)
Else
Set f = fso.OpenTextFile(App.Path & "\Archivio.txt", 8)
End If
Ricevi = MSComm1.Input
f.Write Ricevi & Now
f.Close
sSave = ""
If Len(Ricevi) Then
Text1.Text = Text1.Text & Ricevi
End If
End Sub
E ho notato che mi crea il file "Archivio.txt" con la lettura del codice e dell'orario. Ma non è formattato molto bene
Questo è ciò che vedo nel file:
codice:
CODICE LETTO ->0001<-
29/11/2004 12.44.03