Sub OnClick(Byval Item)
'HMIRuntime.Trace Now & vbCrLf
Dim objExcel ,i, m ,m2,m3,m4,Marka_shihti,k , arrPodg , arrSklad
Dim Kol_Shihta, Nom_plav_zagr, NomPlTeg, MarkSTeg,KolA11,SumA11
Dim KolA11a,SumA11a,SumA12,KolA12,SumA11e,KolA11e,SumPol,KolPol
Dim SumSlit11,KolSlit11,SumSlit12,KolSlit12 ,SumStrug ,KolStrug
Dim SumBrak ,KolBrak,SumAllSklad,SDay,SMonth ,SYear,SHour,SMinute
Dim TimeStPod,TimeFinPod, TimePrihod, TimeRashod, PodgUroven
Dim FDay,FMonth ,FYear,FHour,FMinute,VerifiTimeFin,VerifiTimeStart
Dim arrRafinir,BornAcid,SumBorn,GMF1,GMF2,SumGMF,Soda1,Soda2,SumSoda
Dim SumAllRafinir,SumAllZagruz
Dim arrVosst,BornAcidShlak,SumBornShlak,GMF1Shlak,GMF2Shlak,SumGMFShlak
Dim Soda1Shlak,Soda2Shlak,SumSodaShlak,SumAllShlak
Dim PutSaveFile, NameFile, DataPlavk ,MsgX,MsgX2,fso,Save1
Dim strok,stolb
'Set rst = CreateObject("ADODB.Recordset")
'con = "Provider = SQLOLEDB;Initial Catalog = " & "S01_@DatasourceNameRT" & ";Data Source = S01\WinCC;Integrated Security = SSPI"
'
NomPlTeg = HMIRuntime.Tags("NomPLAV").Read
MarkSTeg = HMIRuntime.Tags("MarkSTeg").Read
arrSklad = UARead ("Sklad")
arrPodg = UARead ("Podgotovka")
arrRafinir = UARead ("Rafinirovanie")
arrVosst = UARead ("Vosstanovlenie")
'================================================SKLAD=========================================
For m = 0 To (UBound(arrSklad)-1)
If arrSklad(m,5) = NomPlTeg Or NomPlTeg = "0" Then
'=============================A1-1==================================
If arrSklad(m,1)="A1-1" Then
KolA11 = Int (arrSklad(m,2))
SumA11 = SumA11 + KolA11
'HMIRuntime.Trace " KolS " & KolA11 & " SumKS " & SumA11
End If
'=============================A1-1a==================================
If arrSklad(m,1)="A1-1a" Then
KolA11a = Int (arrSklad(m,2))
SumA11a = SumA11a + KolA11a
'HMIRuntime.Trace " KolS " & KolA11a & " SumKS " & SumA11a
End If
'=============================A1-2==================================
If arrSklad(m,1)="A1-2" Then
KolA12 = Int (arrSklad(m,2))
SumA12 = SumA12 + KolA12
'HMIRuntime.Trace " KolS " & KolA12 & " SumKS " & SumA12
End If
'=============================A1-1e==================================
If arrSklad(m,1)="À1-1Å" Then
KolA11e = Int (arrSklad(m,2))
SumA11e = SumA11e + KolA11e
'HMIRuntime.Trace " KolS " & KolA12 & " SumKS " & SumA12
End If
'=============================ÏÎËÎÑÀ==================================
If arrSklad(m,1)="Ïîëîñà" Then
KolPol = Int (arrSklad(m,2))
SumPol = SumPol + KolPol
'HMIRuntime.Trace " KolS " & KolA12 & " SumKS " & SumA12
End If
'=============================ÑëèòîêÀ1-1==================================
If arrSklad(m,1)="Ñëèòêè 1-1" Then
KolSlit11 = Int (arrSklad(m,2))
SumSlit11 = SumSlit11 + KolSlit11
'HMIRuntime.Trace " KolS " & KolA12 & " SumKS " & SumA12
End If
'=============================ÑëèòîêÀ1-2==================================
If arrSklad(m,1)="Ñëèòêè 1-2" Then
KolSlit12 = Int (arrSklad(m,2))
SumSlit12 = SumSlit12 + KolSlit12
'HMIRuntime.Trace " KolS " & KolA12 & " SumKS " & SumA12
End If
'=============================Ñòðóæêà==================================
If arrSklad(m,1)="Ñòðóæêà" Then
KolStrug = Int (arrSklad(m,2))
SumStrug = SumStrug + KolStrug
'HMIRuntime.Trace " KolS " & KolA12 & " SumKS " & SumA12
End If
'=============================ÊàòàíêàÁðàê==================================
If arrSklad(m,1)="Áðàê" Then
SumBrak = Int (SumBrak)
KolBrak = Int (arrSklad(m,2))
SumBrak = SumBrak + KolBrak
'HMIRuntime.Trace " KolS " & KolA12 & " SumKS " & SumA12
End If
End If
Marka_shihti = arrSklad(m,1)
Kol_Shihta = arrSklad(m,2)
Nom_plav_zagr = arrSklad(m,5)
TimePrihod = arrSklad(m,3)
TimeRashod = arrSklad(m,4)
' Nom_Porcii_Zagr = arr(m,7)
' Zadanie_plavka= arr(m,6)
' Zadanie_plavka=Left(Zadanie_plavka,12)
' Nom_plav_Plan = arr(m,8)
Next
SumAllSklad = SumA11+SumA11a+SumA12+SumA11e+SumPol+SumSlit11+SumSlit12+SumStrug+SumBrak
'=========================================RAFINIROVANIE=======================================
For m4 = 0 To (UBound(arrRafinir)-1)
HMIRuntime.Trace arrRafinir(m4,1)& vbCrLf
If arrRafinir(m4,1) = NomPlTeg Then
'===========BORN====================
BornAcid = Int(arrRafinir(m4,79))
SumBorn = SumBorn + BornAcid
'============GMF====================
GMF1 = Int(arrRafinir(m4,80))
GMF2 = Int(arrRafinir(m4,81))
SumGMF = SumGMF + (GMF1 + GMF2)
'=============SODA===================
Soda1 = Int(arrRafinir(m4,82))
Soda2 = Int(arrRafinir(m4,83))
SumSoda = SumSoda + (Soda1 + Soda2)
'====================================
HMIRuntime.Trace vbCrLf & m4 & vbCrLf & m3 & vbCrLf & BornAcid& vbCrLf & SumBorn& vbCrLf & GMF1& vbCrLf & GMF2 & vbCrLf & Soda1 & vbCrLf
Exit For
End If
Next
SumAllRafinir = SumBorn + SumGMF + SumSoda
SumAllZagruz = SumAllRafinir + SumAllSklad
'=======================SHLAK===Vosstanovlenie==============================================================
For m3 = 0 To (UBound(arrVosst)-1)
'HMIRuntime.Trace arrVosst(m3,1)& vbCrLf
If arrVosst(m3,1) = NomPlTeg Then
'===========BORN==Shlak==================
BornAcidShlak = Int(arrVosst(m3,76))
SumBornShlak = SumBornShlak + BornAcidShlak
'============GMF==Shlak==================
GMF1Shlak = Int(arrVosst(m3,77))
GMF2Shlak = Int(arrVosst(m3,78))
SumGMFShlak = SumGMFShlak + (GMF1Shlak + GMF2Shlak)
'=============SODA==Shlak=================
Soda1Shlak = Int(arrVosst(m3,79))
Soda2Shlak = Int(arrVosst(m3,80))
SumSodaShlak = SumSodaShlak + (Soda1Shlak + Soda2Shlak)
'====================================
'HMIRuntime.Trace vbCrLf & m4 & vbCrLf & m3 & vbCrLf & BornAcid& vbCrLf & SumBorn& vbCrLf & GMF1& vbCrLf & GMF2 & vbCrLf & Soda1 & vbCrLf
Exit For
End If
Next
SumAllShlak = SumBornShlak + SumGMFShlak + SumSodaShlak
'====================================Vremya plavki===================================
For m2 = 0 To (UBound(arrPodg)-1)
If arrPodg(m2,45)= NomPlTeg Then
TimeStPod = arrPodg(m2,49)
TimeFinPod = arrPodg(m2+1,49)
PodgUroven = arrPodg(m2+1,47)
TimeStPod = CDate(TimeStPod)
SDay = Day(TimeStPod)
SMonth = Month(TimeStPod)
SYear = Year(TimeStPod)
SHour = Hour(TimeStPod)
SMinute = Minute(TimeStPod)
TimeFinPod = CDate(TimeFinPod)
FDay = Day(TimeFinPod)
FMonth = Month(TimeFinPod)
FYear = Year(TimeFinPod)
FHour = Hour(TimeFinPod)
FMinute = Minute(TimeFinPod)
VerifiTimeStart = Int(SYear)
VerifiTimeFin = Int(FYear)
Exit For
End If
Next
'===========================PROVERKA NA NALICHIE FILE.xls=============================================================
Save1 = False
PutSaveFile = HMIRuntime.Tags("@UA_Plavka_Otchyet_Put").Read
DataPlavk = SDay & "." & SMonth & "." & SYear & "ã"
NameFile = "Ïëàâêà ¹ " & NomPlTeg & "_" & DataPlavk
HMIRuntime.Trace "__________" & PutSaveFile & NameFile & vbCrLf
Set fso= CreateObject("Scripting.FileSystemObject")
With fso
If .FileExists(PutSaveFile & NameFile & ".xls" ) Then
Save1 = True
MsgX2 = MsgBox ( NameFile &" Òàêîé ôàéë óæå ñóùåñòâóåò. Çàìåíèòü? " ,4,NameFile)
If MsgX2 = 6 Then
.DeleteFile PutSaveFile & NameFile & ".xls", True
HMIRuntime.Trace " ÔÀÉË ÓÄÀË¨Í "
Save1 = False
Else
Save1 = True
End If
End If
End With
'=========================CREATE EXCEL=======================================================
If save1 = False Then
Set objExcel = CreateObject("Excel.application")
objExcel.Visible = False
objExcel.Workbooks.add
strok = 0
stolb = 0
With objExcel.ActiveSheet
.Cells.Font.Italic = True
.Cells.Font.Bold = True
.Cells.Font.Size = 12
.Cells.Font.Name = "Arial" '"Times New Roman"
.Columns(stolb+1).ColumnWidth = 12
.Columns(stolb+2).ColumnWidth = 30
.Columns(stolb+3).ColumnWidth = 10
.Columns(stolb+4).ColumnWidth = 4
.Columns(stolb+5).ColumnWidth = 18
.Columns(stolb+7).ColumnWidth = 22
.Columns(stolb+9).ColumnWidth = 7
.Columns(stolb+11).ColumnWidth = 4
.Cells(strok+3,stolb+1).Font.Size = 16
.Cells(strok+3,stolb+1).Font.Italic = False
.Cells(strok+3,stolb+1).Value ="Çàãðóæåíî:"
.Cells(strok+26,stolb+1).Font.Size = 16
.Cells(strok+26,stolb+1).Font.Italic = False
.Cells(strok+26,stolb+1).Font.Underline = True
.Cells(strok+26,stolb+1).Value ="Îòëèòî:"
.Cells(strok+1,stolb+2).Font.Size = 20
.Cells(strok+1,stolb+2).Font.Italic = False
.Cells(strok+1,stolb+2).Value = "ÏËÀÂÊÀ"
.Cells(strok+1,stolb+2).HorizontalAlignment = 4
.Cells(strok+1,stolb+3).Font.Size = 16
.Cells(strok+1,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+1,stolb+3).Borders(9).Weight = 4
.Cells(strok+2,stolb+2).Font.Bold = False
.Cells(strok+2,stolb+3).Font.Bold = False
.Cells(strok+2,stolb+5).Font.Bold = False
.Cells(strok+2,stolb+2).Font.Size = 11
.Cells(strok+2,stolb+3).Font.Size = 11
.Cells(strok+2,stolb+5).Font.Size = 11
.Cells(strok+4,stolb+2).Value ="Ëîì À1-1"
.Cells(strok+5,stolb+2).Value ="Ëîì À1-1à"
.Cells(strok+6,stolb+2).Value ="Ëîì À1-2"
.Cells(strok+7,stolb+2).Value ="Ëîì À1-1 ""Å"""
.Cells(strok+8,stolb+2).Value ="Ïîëîñà (ìåäü)"
.Cells(strok+9,stolb+2).Value ="Ñëèòîê À1-1 (÷èñòûå)"
.Cells(strok+10,stolb+2).Value ="Ñëèòîê À1-2 (øëàêîâûå)"
.Cells(strok+11,stolb+2).Value ="Ñëèòîê Ã-2"
.Cells(strok+12,stolb+2).Value ="Ñòðóæêà (ìåäü)"
.Cells(strok+13,stolb+2).Value ="Êàòàíêà áðàê"
.Cells(strok+14,stolb+2).Value ="Ïåðåõîäÿùèé îñòàòîê"
.Cells(strok+15,stolb+2).Borders(9).LineStyle = 1
.Cells(strok+15,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+15,stolb+4).Borders(9).LineStyle = 1
.Cells(strok+15,stolb+2).Borders(9).Weight = 3
.Cells(strok+15,stolb+3).Borders(9).Weight = 3
.Cells(strok+15,stolb+4).Borders(9).Weight = 3
.Cells(strok+16,stolb+2).Value =Chrw (&h2211) & " ="
.Cells(strok+23,stolb+2).Value =Chrw (&h2211) & " ="
.Cells(strok+16,stolb+2).HorizontalAlignment = 4
.Cells(strok+23,stolb+2).HorizontalAlignment = 4
.Cells(strok+16,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+16,stolb+3).Borders(9).Weight = 3
.Cells(strok+23,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+23,stolb+3).Borders(9).Weight = 3
.Cells(strok+24,stolb+2).Borders(9).LineStyle = 1
.Cells(strok+24,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+24,stolb+4).Borders(9).LineStyle = 1
.Cells(strok+24,stolb+2).Borders(9).Weight = 3
.Cells(strok+24,stolb+3).Borders(9).Weight = 3
.Cells(strok+24,stolb+4).Borders(9).Weight = 3
.Cells(strok+18,stolb+2).Value ="Áîðíàÿ êèñëîòà"
.Cells(strok+19,stolb+2).Value ="ÃÌÔ"
.Cells(strok+20,stolb+2).Value ="Ñîäà"
.Cells(strok+21,stolb+2).Value =""
.Cells(strok+22,stolb+2).Value =""
.Cells(strok+27,stolb+2).Value ="Êàòàíêà"
.Cells(strok+28,stolb+2).Value ="Ïîëîñà (ìåäü)"
.Cells(strok+29,stolb+2).Value ="Ñëèòîê À1-1 (÷èñòûå)"
.Cells(strok+30,stolb+2).Value ="Ñòðóæêà (ìåäü)"
.Cells(strok+31,stolb+2).Value ="Êàòàíêà áðàê"
.Cells(strok+32,stolb+2).Value =""
.Cells(strok+33,stolb+2).Value ="Øëàêè (áîðíàÿ êèñëîòà)"
.Cells(strok+34,stolb+2).Value ="Øëàêè (ÃÌÔ)"
.Cells(strok+35,stolb+2).Value ="Øëàêè (ñîäà)"
.Cells(strok+36,stolb+2).Value =""
.Cells(strok+37,stolb+2).Borders(9).LineStyle = 1
.Cells(strok+37,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+37,stolb+4).Borders(9).LineStyle = 1
.Cells(strok+37,stolb+2).Borders(9).Weight = 3
.Cells(strok+37,stolb+3).Borders(9).Weight = 3
.Cells(strok+37,stolb+4).Borders(9).Weight = 3
.Cells(strok+38,stolb+2).Value =Chrw (&h2211) & " ="
.Cells(strok+38,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+38,stolb+2).HorizontalAlignment = 4
.Cells(strok+38,stolb+3).Borders(9).Weight = 3
.Cells(strok+40,stolb+2).Value ="Ïåðåõîäÿùèé îñòàòîê " & Chrw (&h2248)
.Cells(strok+43,stolb+2).Value ="Óãàð"
.Cells(strok+43,stolb+2).HorizontalAlignment = 3
.Cells(strok+45,stolb+2).Value ="Çàìåð ãëóáèíû"
.Cells(strok+46,stolb+2).Value ="Ðàñ÷åòíûé îñòàòîê"
.Cells(strok+47,stolb+2).Value ="Ìàñòåð ñìåíû "
.Cells(strok+51,stolb+2).Font.Italic = False
.Cells(strok+51,stolb+2).Font.Bold = False
.Cells(strok+51,stolb+2).Font.Size = 16
.Cells(strok+51,stolb+2).Value ="Ãë.òåõíîëîã "
.Cells(strok+15,stolb+5).Font.Size = 10
.Cells(strok+17,stolb+5).Font.Size = 10
.Cells(strok+32,stolb+5).Font.Size = 10
.Cells(strok+36,stolb+5).Font.Size = 10
.Cells(strok+15,stolb+5).Value ="çàãðóæåíî ëîìîâ ="
.Cells(strok+17,stolb+5).Value ="çàãðóæåíî ôëþñîâ ="
.Cells(strok+32,stolb+5).Value ="âñåãî îòëèòî ="
.Cells(strok+36,stolb+5).Value ="âñåãî øëàêîâ ="
.Cells(strok+43,stolb+5).Value =" èëè"
''''''''''''''''''''''''''''''''''''''''' .Cells(strok+47,3).Value ="Òðåòüÿêîâ"
.Cells(strok+47,stolb+3).Font.Bold = False
.Cells(strok+47,stolb+3).Font.Size = 16
.Cells(strok+47,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+51,stolb+5).Font.Italic = False
.Cells(strok+51,stolb+5).Font.Size = 16
.Cells(strok+51,stolb+5).Value ="Ìàêàðîâ Â. Þ."
.Cells(strok+23,stolb+7).Font.Underline = True
.Cells(strok+23,stolb+7).Value ="Âñåãî çàãðóæåíî"
.Cells(strok+40,stolb+7).Font.Underline = True
.Cells(strok+40,stolb+7).Value ="Âñåãî ñäàíî"
.Cells(strok+45,stolb+4).Value ="ìì"
.Cells(strok+45,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+15,stolb+7).Value ="êã."
.Cells(strok+15,stolb+6).Borders(9).LineStyle = 1
.Cells(strok+17,stolb+7).Value ="êã."
.Cells(strok+17,stolb+6).Borders(9).LineStyle = 1
.Cells(strok+32,stolb+7).Value ="êã."
.Cells(strok+32,stolb+6).Borders(9).LineStyle = 1
.Cells(strok+36,stolb+7).Value ="êã."
''.Cells(strok+36,stolb+6).Borders(9).LineStyle = 1
.Cells(strok+23,stolb+9).Value ="êã."
.Cells(strok+23,stolb+8).Borders(9).LineStyle = 1
.Cells(strok+40,stolb+9).Value ="êã."
.Cells(strok+40,stolb+8).Borders(9).LineStyle = 1
.Cells(strok+49,stolb+9).Value ="êã, èëè"
.Cells(strok+49,stolb+8).Borders(9).LineStyle = 1
.Cells(strok+49,stolb+10).Borders(9).LineStyle = 1
.Cells(strok+43,stolb+8).Font.Size = 16
.Cells(strok+43,stolb+8).Value ="%"
.Cells(strok+49,stolb+11).Font.Size = 16
.Cells(strok+49,stolb+11).Value ="%"
.Cells(strok+43,stolb+6).Borders(9).LineStyle = 1
.Cells(strok+43,stolb+7).Borders(9).LineStyle = 1
'====================================
.Range("e2:f2:g2").Merge(True)
.Range("f43:g43").Merge(True)
.Range("f45:g45").Merge(True)
.Range("f46:g46").Merge(True)
.Range("f47:g47").Merge(True)
.Range("f49:g49").Merge(True)
.Range("d50:g50").Merge(True)
.Range("d43:e43").Merge(True)
'====================================
.Cells(strok+45,stolb+6).Value ="Âñåãî çàãðóæåíî â ïå÷ü"
.Cells(strok+46,stolb+6).Value ="Îòëèòî"
.Cells(strok+47,stolb+6).Value ="Ðàñ÷åòíûé îñòàòîê"
.Cells(strok+49,stolb+6).Value ="Ðàñ÷åòíûé óãàð"
.Cells(strok+45,stolb+6).HorizontalAlignment = 3
.Cells(strok+46,stolb+6).HorizontalAlignment = 3
.Cells(strok+47,stolb+6).HorizontalAlignment = 3
.Cells(strok+49,stolb+6).HorizontalAlignment = 3
.Cells(strok+45,stolb+8).Borders(9).LineStyle = 1
.Cells(strok+46,stolb+8).Borders(9).LineStyle = 1
.Cells(strok+47,stolb+8).Borders(9).LineStyle = 1
.Cells(strok+49,stolb+8).Borders(9).LineStyle = 1
End With
'====================================KG============================================
For i=4 To 46
If i=15 Or i=17 Or i=24 Or i=25 Or i=26 Or i=32 Or i=36 Or i=37 Or i=39 Or i=41 Or i=42 Or i=44 Or i=45 Then
i=i
Else
With objExcel
.Cells(strok+i,stolb+4).Font.Bold = False
.Cells(strok+i,stolb+4).Font.Italic = True
.Cells(strok+i,stolb+4).Value ="êã."
.Cells(strok+i,stolb+3).Borders(9).LineStyle = 1
.Cells(strok+i,stolb+3).Borders(9).Weight = 2
End With
End If
Next
objExcel.ActiveSheet.Cells(strok+43,stolb+4).Font.Bold = True
objExcel.ActiveSheet.Cells(strok+43,stolb+4).Value ="êã, èëè"
'====================================SUMMA==================================================
With objExcel.ActiveSheet
.Cells(strok+1,stolb+3).Value = "¹ " & NomPlTeg
.Cells(strok+15,stolb+6).Value = SumAllSklad
.Cells(strok+17,stolb+6).Value = SumAllRafinir
.Cells(strok+23,stolb+8).Value = SumAllZagruz
.Cells(strok+45,stolb+3).Value = PodgUroven
.Cells(strok+36,stolb+6).Value = SumAllShlak
End With
'==================SKRYIT PUSTYIE STROKI============================================
Dim Rows
With objExcel.ActiveSheet
.Rows(14).EntireRow.Hidden = True '== ñêðûë íå íóæíûå ñòðîêè
.Rows(21).EntireRow.Hidden = True
.Rows(22).EntireRow.Hidden = True
.Rows(11).EntireRow.Hidden = True
If SumA11 = 0 Then
.Rows(4).EntireRow.Hidden = True
Else
.Cells(strok+4,stolb+3).Value = SumA11
End If
If SumA11a = 0 Then
.Rows(5).EntireRow.Hidden = True
Else
.Cells(strok+5,stolb+3).Value = SumA11a
End If
If SumA12 = 0 Then
.Rows(6).EntireRow.Hidden = True
Else
.Cells(strok+6,stolb+3).Value = SumA12
End If
If SumA12 = 0 Then
.Rows(6).EntireRow.Hidden = True
Else
.Cells(strok+6,stolb+3).Value = SumA12
End If
If SumA11e = 0 Then
.Rows(7).EntireRow.Hidden = True
Else
.Cells(strok+7,stolb+3).Value = SumA11e
End If
If SumPol = 0 Then
.Rows(8).EntireRow.Hidden = True
Else
.Cells(strok+8,stolb+3).Value = SumPol
End If
If SumSlit11 = 0 Then
.Rows(9).EntireRow.Hidden = True
Else
.Cells(strok+9,stolb+3).Value = SumSlit11
End If
If SumSlit12 = 0 Then
.Rows(10).EntireRow.Hidden = True
Else
.Cells(strok+10,stolb+3).Value = SumSlit12
End If
If SumStrug = 0 Then
.Rows(12).EntireRow.Hidden = True
Else
.Cells(strok+12,stolb+3).Value = SumStrug
End If
If SumBrak = 0 Then
.Rows(13).EntireRow.Hidden = True
Else
.Cells(strok+13,stolb+3).Value = SumBrak
End If
If SumBorn = 0 Then
.Rows(18).EntireRow.Hidden = True
Else
.Cells(strok+18,stolb+3).Value = SumBorn
End If
If SumGMF = 0 Then
.Rows(19).EntireRow.Hidden = True
Else
.Cells(strok+19,stolb+3).Value = SumGMF
End If
If SumSoda = 0 Then
.Rows(20).EntireRow.Hidden = True
Else
.Cells(strok+20,stolb+3).Value = SumSoda
End If
If SumBornShlak = 0 Then
.Rows(33).EntireRow.Hidden = True
Else
.Cells(strok+33,stolb+3).Value = SumBornShlak
End If
If SumSodaShlak = 0 Then
.Rows(35).EntireRow.Hidden = True
Else
.Cells(strok+35,stolb+3).Value = SumSodaShlak
End If
If SumGMFShlak = 0 Then
.Rows(34).EntireRow.Hidden = True
Else
.Cells(strok+34,stolb+3).Value = SumGMFShlak
End If
End With
'============================PROVERKA VREMENI=====================================================
If VerifiTimeStart = 0 Or VerifiTimeStart = 1899 Then
objExcel.ActiveSheet.Cells(strok+2,stolb+2).Value ="ÍÅ ÑÓÙÅÑÒÂÓÅÒ"
Else
objExcel.ActiveSheet.Cells(strok+2,stolb+2).Value ="Íà÷àòà: " & SDay & "." & SMonth & "." & SYear & "ã"
objExcel.ActiveSheet.Cells(strok+2,stolb+3).Value = "â " & SHour & ":" & SMinute
If VerifiTimeFin = 0 Or VerifiTimeFin = 1899 Then
objExcel.ActiveSheet.Cells(strok+2,stolb+5).Value ="Òåêóùàÿ."
Else
objExcel.ActiveSheet.Cells(strok+2,stolb+5).Value ="Çàâåðøåíà: " & FDay & "." & FMonth & "." & FYear & "ã "_
& " â " & FHour & ":" & FMinute
End If
End If
'====================================NASTROYIKA STRANICI=====================================
With objExcel.ActiveSheet.PageSetup
.Zoom = False
.CenterVertically = True
.FitToPagesWide = 1
.FitToPagesTall = 1
.CenterHorizontally = True
.CenterVertically = True
.RightMargin = 10
.leftMargin = 20
.TopMargin = 15
.HeaderMargin = 10
End With
'========================SAVE FILE============================================================
End If
If Save1 = False Then
objExcel.ActiveSheet.SaveAs PutSaveFile & NameFile
MsgX = MsgBox ("Ôàéë óñïåøíî ñîõðàí¸í.Îòêðûòü ôàéë" & NameFile & " ? " ,4,NameFile)
If MsgX = 6 Then
objExcel.Visible = True
Else
objExcel.Quit
Set objExcel = Nothing
Set fso = Nothing
End If
End If
Set fso = Nothing
'+++++++++++++++++++++++++++++++++++++++++++Ky4a++++++++++++++++++++++++++++++++++++
'+++++++++++++++++++++++++++++++++++++++++++Ky4a++++++++++++++++++++++++++++++++++++
'+++++++++++++++++++++++++++++++++++++++++++Ky4a++++++++++++++++++++++++++++++++++++
''======================== Ñîõðàíåíèå ôàéëà =====================================
''Set fld = ScreenItems("I/O Field3")
''sFileName = fld.OutputValue
'sFileName = "D:\" & Replace(Time, ":", "_", 1,-1)& ".xlsx"'fld.OutputValue
'ExcelSheet.SaveAs sFileName
'ExcelSheet.Application.Quit
'Set ExcelSheet = Nothing
'objExcelApp.Quit
'Set objExcelApp = Nothing
''------------------------
'Ret = MsgBox ("Ôàéë Åêñåëü çàïèñàí íà äèñê. Îòêðûòü ôàéë ?", vbYesNo, "Open file")
'If Ret = vbYes Then
'CreateObject("WScript.Shell").Run sFileName, 1
'End If
''Sub SaveAs()
''
''Dim WorkbookName As String
''
''WorkbookName = Application.GetSaveAsFilename(, , , "Ñîõðàíèòü ôàéë êàê ...")
''
''If Len(WorkbookName) = 0 Or WorkbookName = "False" Then Exit Sub 'ñëó÷àé îòìåíû
'
'ActiveWorkbook.SaveAs WorkbookName
'
'End Sub
'
'Dim objFSO, objRegExp, Path, objFolder, objItem
'Set objFSO = CreateObject("Scripting.FileSystemObject")
'Path = objFSO.GetAbsolutePathName("")
'Set objFolder = objFSO.GetFolder(Path)
'Set objRegExp = CreateObject("VBScript.RegExp")
'objRegExp.Global = True
'objRegExp.Multiline = True
'objRegExp.IgnoreCase = True
'objRegExp.Pattern = NameFile
'For Each objItem In objFolder.Files
' If objRegExp.Test(objItem.Name) = True Then
' WScript.Echo "ôàéë "&objItem.Name&" íàéäåí"
' End If
'Next
' objExcel.ActiveSheet.Range("a19:d19").Select
'Selection.EntireRow.Hidden = True
'strok = strok-1
'Selection.EntireRow.Hidden = True
'objExcel.ActiveSheet.Rows(19).EntireColumn.Hidden = True 'Ñêðûòü ñòðîêó
' objExcel.ActiveSheet.Range("a19:d19").Select
'Selection.EntireRow.Hidden = True
'strok = strok-1
'Selection.EntireRow.Hidden = True
'objExcel.ActiveSheet.Rows(19).EntireColumn.Hidden = True 'Ñêðûòü ñòðîêó
End Sub