- 0
- 온텍
- 조회 수 1950
Sub MakeReport()
if ( FileExists("C:\보고서") <> TRUE ) Then
MkDir "C:\보고서"
End if
'양식 파일 이름
FormFileName$ = "ReportForm.txt"
' 파일이름을 생성. 년/월/일
fName$ = "C:\보고서\" & ReportTimeStr("-1일",12) & ".txt"
' 파일이 없을 경우 새로운 빈 파일을 복사한다.
If (FileExists(fName$) <> TRUE) Then
FileCopy FormFileName$, fName$
End If
TabChr$ = Chr$(9)
' 텍스트 파일에 데이터를 써 넣는다.
Open fName$ For Output As #1
Data$ = TabChr$ + "시간" + TabChr$ + "태그1" + TabChr$ + "태그2" + TabChr$ + "태그3"
Print #1,Data$
Data$ = TabChr$ + "-----------------------------"
Print #1,Data$
TAG1Data1$ = Cstr(TLogVal("태그1","-1일1시","순간값"))
TAG1Data2$ = Cstr(TLogVal("태그1","-1일2시","순간값"))
TAG1Data3$ = Cstr(TLogVal("태그1","-1일3시","순간값"))
TAG1Data4$ = Cstr(TLogVal("태그1","-1일4시","순간값"))
TAG1Data5$ = Cstr(TLogVal("태그1","-1일5시","순간값"))
TAG1Data6$ = Cstr(TLogVal("태그1","-1일6시","순간값"))
TAG1Data7$ = Cstr(TLogVal("태그1","-1일7시","순간값"))
TAG1Data8$ = Cstr(TLogVal("태그1","-1일8시","순간값"))
TAG1Data9$ = Cstr(TLogVal("태그1","-1일9시","순간값"))
TAG1Data10$ = Cstr(TLogVal("태그1","-1일10시","순간값"))
TAG1Data11$ = Cstr(TLogVal("태그1","-1일11시","순간값"))
TAG1Data12$ = Cstr(TLogVal("태그1","-1일12시","순간값"))
TAG1Data13$ = Cstr(TLogVal("태그1","-1일13시","순간값"))
TAG1Data14$ = Cstr(TLogVal("태그1","-1일14시","순간값"))
TAG1Data15$ = Cstr(TLogVal("태그1","-1일15시","순간값"))
TAG1Data16$ = Cstr(TLogVal("태그1","-1일16시","순간값"))
TAG1Data17$ = Cstr(TLogVal("태그1","-1일17시","순간값"))
TAG1Data18$ = Cstr(TLogVal("태그1","-1일18시","순간값"))
TAG1Data19$ = Cstr(TLogVal("태그1","-1일19시","순간값"))
TAG1Data20$ = Cstr(TLogVal("태그1","-1일20시","순간값"))
TAG1Data21$ = Cstr(TLogVal("태그1","-1일21시","순간값"))
TAG1Data22$ = Cstr(TLogVal("태그1","-1일22시","순간값"))
TAG1Data23$ = Cstr(TLogVal("태그1","-1일23시","순간값"))
TAG1Data24$ = Cstr(TLogVal("태그1","0일0시","순간값"))
TAG2Data1$ = Cstr(TLogVal("태그2","-1일1시","순간값"))
TAG2Data2$ = Cstr(TLogVal("태그2","-1일2시","순간값"))
TAG2Data3$ = Cstr(TLogVal("태그2","-1일3시","순간값"))
TAG2Data4$ = Cstr(TLogVal("태그2","-1일4시","순간값"))
TAG2Data5$ = Cstr(TLogVal("태그2","-1일5시","순간값"))
TAG2Data6$ = Cstr(TLogVal("태그2","-1일6시","순간값"))
TAG2Data7$ = Cstr(TLogVal("태그2","-1일7시","순간값"))
TAG2Data8$ = Cstr(TLogVal("태그2","-1일8시","순간값"))
TAG2Data9$ = Cstr(TLogVal("태그2","-1일9시","순간값"))
TAG2Data10$ = Cstr(TLogVal("태그2","-1일10시","순간값"))
TAG2Data11$ = Cstr(TLogVal("태그2","-1일11시","순간값"))
TAG2Data12$ = Cstr(TLogVal("태그2","-1일12시","순간값"))
TAG2Data13$ = Cstr(TLogVal("태그2","-1일13시","순간값"))
TAG2Data14$ = Cstr(TLogVal("태그2","-1일14시","순간값"))
TAG2Data15$ = Cstr(TLogVal("태그2","-1일15시","순간값"))
TAG2Data16$ = Cstr(TLogVal("태그2","-1일16시","순간값"))
TAG2Data17$ = Cstr(TLogVal("태그2","-1일17시","순간값"))
TAG2Data18$ = Cstr(TLogVal("태그2","-1일18시","순간값"))
TAG2Data19$ = Cstr(TLogVal("태그2","-1일19시","순간값"))
TAG2Data20$ = Cstr(TLogVal("태그2","-1일20시","순간값"))
TAG2Data21$ = Cstr(TLogVal("태그2","-1일21시","순간값"))
TAG2Data22$ = Cstr(TLogVal("태그2","-1일22시","순간값"))
TAG2Data23$ = Cstr(TLogVal("태그2","-1일23시","순간값"))
TAG2Data24$ = Cstr(TLogVal("태그2","0일0시","순간값"))
TAG3Data1$ = Cstr(TLogVal("태그3","-1일1시","순간값"))
TAG3Data2$ = Cstr(TLogVal("태그3","-1일2시","순간값"))
TAG3Data3$ = Cstr(TLogVal("태그3","-1일3시","순간값"))
TAG3Data4$ = Cstr(TLogVal("태그3","-1일4시","순간값"))
TAG3Data5$ = Cstr(TLogVal("태그3","-1일5시","순간값"))
TAG3Data6$ = Cstr(TLogVal("태그3","-1일6시","순간값"))
TAG3Data7$ = Cstr(TLogVal("태그3","-1일7시","순간값"))
TAG3Data8$ = Cstr(TLogVal("태그3","-1일8시","순간값"))
TAG3Data9$ = Cstr(TLogVal("태그3","-1일9시","순간값"))
TAG3Data10$ = Cstr(TLogVal("태그3","-1일10시","순간값"))
TAG3Data11$ = Cstr(TLogVal("태그3","-1일11시","순간값"))
TAG3Data12$ = Cstr(TLogVal("태그3","-1일12시","순간값"))
TAG3Data13$ = Cstr(TLogVal("태그3","-1일13시","순간값"))
TAG3Data14$ = Cstr(TLogVal("태그3","-1일14시","순간값"))
TAG3Data15$ = Cstr(TLogVal("태그3","-1일15시","순간값"))
TAG3Data16$ = Cstr(TLogVal("태그3","-1일16시","순간값"))
TAG3Data17$ = Cstr(TLogVal("태그3","-1일17시","순간값"))
TAG3Data18$ = Cstr(TLogVal("태그3","-1일18시","순간값"))
TAG3Data19$ = Cstr(TLogVal("태그3","-1일19시","순간값"))
TAG3Data20$ = Cstr(TLogVal("태그3","-1일20시","순간값"))
TAG3Data21$ = Cstr(TLogVal("태그3","-1일21시","순간값"))
TAG3Data22$ = Cstr(TLogVal("태그3","-1일22시","순간값"))
TAG3Data23$ = Cstr(TLogVal("태그3","-1일23시","순간값"))
TAG3Data24$ = Cstr(TLogVal("태그3","0일0시","순간값"))
Print #1,TabChr$ + "1시" + TabChr$ + TAG1Data1$ + TabChr$ + TAG2Data1$ + TabChr$ + TAG3Data1$
Print #1,TabChr$ + "2시" + TabChr$ + TAG1Data2$ + TabChr$ + TAG2Data2$ + TabChr$ + TAG3Data2$
Print #1,TabChr$ + "3시" + TabChr$ + TAG1Data3$ + TabChr$ + TAG2Data3$ + TabChr$ + TAG3Data3$
Print #1,TabChr$ + "4시" + TabChr$ + TAG1Data4$ + TabChr$ + TAG2Data4$ + TabChr$ + TAG3Data4$
Print #1,TabChr$ + "5시" + TabChr$ + TAG1Data5$ + TabChr$ + TAG2Data5$ + TabChr$ + TAG3Data5$
Print #1,TabChr$ + "6시" + TabChr$ + TAG1Data6$ + TabChr$ + TAG2Data6$ + TabChr$ + TAG3Data6$
Print #1,TabChr$ + "7시" + TabChr$ + TAG1Data7$ + TabChr$ + TAG2Data7$ + TabChr$ + TAG3Data7$
Print #1,TabChr$ + "8시" + TabChr$ + TAG1Data8$ + TabChr$ + TAG2Data8$ + TabChr$ + TAG3Data8$
Print #1,TabChr$ + "9시" + TabChr$ + TAG1Data9$ + TabChr$ + TAG2Data9$ + TabChr$ + TAG3Data9$
Print #1,TabChr$ + "10시" + TabChr$ + TAG1Data10$ + TabChr$ + TAG2Data10$ + TabChr$ + TAG3Data10$
Print #1,TabChr$ + "11시" + TabChr$ + TAG1Data11$ + TabChr$ + TAG2Data11$ + TabChr$ + TAG3Data11$
Print #1,TabChr$ + "12시" + TabChr$ + TAG1Data12$ + TabChr$ + TAG2Data12$ + TabChr$ + TAG3Data12$
Print #1,TabChr$ + "13시" + TabChr$ + TAG1Data13$ + TabChr$ + TAG2Data13$ + TabChr$ + TAG3Data13$
Print #1,TabChr$ + "14시" + TabChr$ + TAG1Data14$ + TabChr$ + TAG2Data14$ + TabChr$ + TAG3Data14$
Print #1,TabChr$ + "15시" + TabChr$ + TAG1Data15$ + TabChr$ + TAG2Data15$ + TabChr$ + TAG3Data15$
Print #1,TabChr$ + "16시" + TabChr$ + TAG1Data16$ + TabChr$ + TAG2Data16$ + TabChr$ + TAG3Data16$
Print #1,TabChr$ + "17시" + TabChr$ + TAG1Data17$ + TabChr$ + TAG2Data17$ + TabChr$ + TAG3Data17$
Print #1,TabChr$ + "18시" + TabChr$ + TAG1Data18$ + TabChr$ + TAG2Data18$ + TabChr$ + TAG3Data18$
Print #1,TabChr$ + "19시" + TabChr$ + TAG1Data19$ + TabChr$ + TAG2Data19$ + TabChr$ + TAG3Data19$
Print #1,TabChr$ + "20시" + TabChr$ + TAG1Data20$ + TabChr$ + TAG2Data20$ + TabChr$ + TAG3Data20$
Print #1,TabChr$ + "21시" + TabChr$ + TAG1Data21$ + TabChr$ + TAG2Data21$ + TabChr$ + TAG3Data21$
Print #1,TabChr$ + "22시" + TabChr$ + TAG1Data22$ + TabChr$ + TAG2Data22$ + TabChr$ + TAG3Data22$
Print #1,TabChr$ + "23시" + TabChr$ + TAG1Data23$ + TabChr$ + TAG2Data23$ + TabChr$ + TAG3Data23$
Print #1,TabChr$ + "24시" + TabChr$ + TAG1Data24$ + TabChr$ + TAG2Data24$ + TabChr$ + TAG3Data24$
Close
End Sub
댓글 0
권한이 없습니다.