In the past i have used Citect SCADA software, more specifically cicode, to log values to an excel spread sheet daily at midnight from an event.
is it possible to create VBA on a numeric input change to do the same?
I am not well versed in VBA and any help would be greatly appreciated.
Here is the Cicode that i have used in the past...
// Start of Function "Logfiles"
//
// This function saves information to the C:/Logfiles
// each day.
FUNCTION Logfiles()
FileName = "FLOW" + IntToStr(DateMonth(TimeCurrent())) + IntToStr(DateYear(TimeCurrent(),1));
MonthFile = "C:\LOGFILES\" + FileName + ".CSV";
IF FileExist(MonthFile) = 0 THEN
FileCode=FileOpen(MonthFile,"a");
FileString = "Date,Time,EFFLUENT DAILY FLOW, RUNNING FLOW TOTAL";
FileErr = FileWriteLn(FileCode, FileString);
FileClose(FileCode);
Sleep(1);
END;
FileCode=FileOpen(MonthFile,"a");
FileString = Date() +","+Time()+","+RealToStr(EFF_FLOW_ACC_Daily/1,5,3)
+","+RealToStr(EFF_FLOW_ACC/1,5,3);
FileErr = FileWriteLn(FileCode, FileString);
FileClose(FileCode)
is it possible to create VBA on a numeric input change to do the same?
I am not well versed in VBA and any help would be greatly appreciated.
Here is the Cicode that i have used in the past...
// Start of Function "Logfiles"
//
// This function saves information to the C:/Logfiles
// each day.
FUNCTION Logfiles()
FileName = "FLOW" + IntToStr(DateMonth(TimeCurrent())) + IntToStr(DateYear(TimeCurrent(),1));
MonthFile = "C:\LOGFILES\" + FileName + ".CSV";
IF FileExist(MonthFile) = 0 THEN
FileCode=FileOpen(MonthFile,"a");
FileString = "Date,Time,EFFLUENT DAILY FLOW, RUNNING FLOW TOTAL";
FileErr = FileWriteLn(FileCode, FileString);
FileClose(FileCode);
Sleep(1);
END;
FileCode=FileOpen(MonthFile,"a");
FileString = Date() +","+Time()+","+RealToStr(EFF_FLOW_ACC_Daily/1,5,3)
+","+RealToStr(EFF_FLOW_ACC/1,5,3);
FileErr = FileWriteLn(FileCode, FileString);
FileClose(FileCode)