Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Write_data_to_file()
- Dim fso, f, ts, folder, path, zawartosc_pliku
- 'Dim strDate
- 'Dim strTime
- 'Dim dtmValue
- 'Dim objFSO
- 'Dim fo
- 'strDate = "\Storage Card USB\" & Month(dtmValue) & "_" & Day(dtmValue) & "_"&Year(dtmValue)
- 'strTime = strDate & "\" & Hour(dtmValue) & "-" & Minute(dtmValue) & "-" & Second(dtmValue) & ".csv"
- FileName = "D:\text.txt"
- FileNex = "D:\text1.txt"
- 'folder = "D:\"
- 'path = folder & "11.txt"
- 'Set objFSO = CreateObject("FileCtl.Filesystem")
- 'Set fo= CreateObject("FileCtl.File")
- 'If objFSO.FolderExists (strDate) Then
- ' If Not objFSO.FileExists (strTime) Then
- ' objFSO.CreateTextFile(strTime)
- ' End If
- 'Else
- ' objFSO.CreateFolder (strDate)
- ' objFSO.CreateTextFile (strTime)
- 'End If
- 'zawartosc_pliku = SmartTags("sila) & ",0,0,0,0,0,0,0,"
- 'Catch errors -- Fehler abfangen
- On Error Resume Next
- 'Create object -- Objekt erstellen
- Set fso = CreateObject("Scripting.FileSystemObject")
- If Err.Number <> 0 Then
- ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
- Err.Clear
- Exit Sub
- End If
- ' If no file exists, create a new one -– Datei erstellen, wenn keine vorhanden
- If Not fso.FileExists(FileName) Then
- fso.CreateTextFile FileName
- End If
- 'folder = "C:\Program Dates\Data_OUT\"
- 'path = folder & "11.txt"
- Set f = fso.GetFile(FileName)
- If Err.Number <> 0 Then
- ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
- Err.Clear
- Exit Sub
- End If
- Set ts = f.OpenAsTextStream(8, -2)
- ' mode "8" to append to file
- If Err.Number <> 0 Then
- ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description
- Err.Clear
- Exit Sub
- End If
- ' Write new set of values into file -- Neue Werte in die Datei schreiben'Please replace all sequences which are enclosed with '_' by your own code.
- 'Do While Bools
- 'statements
- 'ts.WriteLine("")
- 'ts.WriteLine("")
- 'ts.WriteLine("START")
- 'ts.WriteLine("Rozpoczęcie rejestracyji.")
- 'ts.WriteLine("Użytkownik:")
- 'ts.WriteLine(user)
- 'ts.WriteLine("Czas rozpoczęcia")
- 'ts.WriteLine(Czas_poczatkowy)
- 'dopisac czas jak zadziala
- 'ts.WriteLine("Czas;Przesuniecie;Pomiar Siła")
- 'Do
- 'If Zapis_do_pliku = True Then
- 'ts.WriteLine(Czas_trwania_prasowania & ";"& Pozycja_przesuniecie & ";" & Pomiar_cisnienie) '
- 'Odkomentować na obiekcie
- 'End If
- 'Loop Until Przycisk_Start1 = True
- 'ts.WriteLine("Czas zakończenia")
- 'ts.WriteLine(Czas_zakonczenia)
- 'ts.WriteLine("Zakończenie rejestracji.")
- 'Loop
- 'Tidy up -- Aufraeumen
- ts.Close
- Set f = Nothing
- Set ts = Nothing
- Set fso = Nothing
- ShowSystemAlarm "Storage of the data was successful!"
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement