Thanks for the The Tuto ! verry helpful. a question: it is possible to add a VB fuction to the project without adding the wincc like in your Exemple. is that possible to make a short tuto for it ? thanks!
with this script I can directly create a csv file on the pc without the hmi panel, right? where to insert the vb file since the script folder is not present
'***************** Write data to CSV File************************* Sub VBFunction_1() ' Write_data_to_file Dim fso, f, ts 'Catch errors On Error Resume Next Datetime = Now() 'Create object 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 If Not fso.FileExists(FileName) Then fso.CreateTextFile FileName End If 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 ts.WriteLine(Material & ";" & Pressure & ";" & Temperature & ";" & Datetime) 'Tidy up ts.Close Set f = Nothing ShowSystemAlarm "Storage of the data was successful!" End Sub ' ********Read data from CSV File****************************** Sub VBFunction_4() ' Read_data_from_file() Dim fso, f, field, MyZf ' Catch errors On Error Resume Next ' Create file object Set fso = CreateObject("Scripting.FileSystemObject") If Err.Number 0 Then ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description Err.Clear Exit Sub End If Set f = fso.OpenTextFile(FileName, 1, 0, -2) If Err.Number 0 Then ShowSystemAlarm "Error #" & CStr(Err.Number) & " " & Err.Description Err.Clear Exit Sub End If ' Read values till end of file Do While Not f.AtEndOfStream MyZf = f.ReadLine Loop field = Split(MyZf, ";") MaterialFromFile = field(0) PressureFromFile = field(1) TemperatureFromFile = field(2) ' Tidy up fso.Close Set f = Nothing Set fso = Nothing ShowSystemAlarm "Readout of the data was successful!" End Sub '**********************************************************
@@automationonline It's possible search 25/10/2022 value in column ex :"A"(date), and show values B and C in tags. same like this vlookup. A | B | C | 10/10/2022 | 102.0 | 99.5 | 25/10/2022 | 102.0 | 99.5 |*** 28/10/2022 | 102.0 | 99.5 |