[SIZE=2][COLOR=#008000]' Script wird aufgerufen durch das Zustands-Bit "St.xxx Programm_aktiv"[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' bearbeitet wird es aber nur bei der fallenden Flanke, da dann erst alle Daten [/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' vorliegen ...[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 Produktions-Daten vorhanden"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] appExcel , fs , wbExcel , wsExcel[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] wArtikel , wF1L1 , wF2L2 , wHoehe , wAbw_min , wAbw_max , wStatus[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Verzeichnis , Datei_Org , Datei_Neu[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] Zeile[/SIZE]
[SIZE=2][COLOR=#008000]' ------------------------------------------------------------------------------[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' Variablen-Zuweisungen ...[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' ------------------------------------------------------------------------------[/COLOR][/SIZE]
[SIZE=2]Verzeichnis = [/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"Info: Verzeichnis ProdDaten"[/COLOR][/SIZE]
[SIZE=2]Verzeichnis = "c:\Prod-Daten\"[/SIZE]
[SIZE=2]Datei_Neu = "Daten " + Right(Year(Now) ,2) + Right(100 + Month(Now) ,2) + Right(100 + Day(Now) ,2) + " .xls"[/SIZE]
[SIZE=2]Datei_Org = "Produktions-Daten.xls"[/SIZE]
[SIZE=2]wArtikel = [/SIZE][SIZE=2][COLOR=#ff0000]Par_KW_Artikel_Nummer[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"PRG Referenzteil-Test"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE][SIZE=2] wArtikel = "Ref.Teil-Test"[/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]Einrichten_Station_211[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE][SIZE=2] wArtikel = "Einrichten"[/SIZE]
[SIZE=2]wF1L1 = [/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 akt.Messwert F1 (L1)"[/COLOR][/SIZE]
[SIZE=2]wF2L2 = [/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 akt.Messwert F2 (L2)"[/COLOR][/SIZE]
[SIZE=2]wHoehe = [/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 akt.Messwert Höhe"[/COLOR][/SIZE]
[SIZE=2]wAbw_max = [/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 Abweichung max."[/COLOR][/SIZE]
[SIZE=2]wAbw_min = [/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 Abweichung min."[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 Auswertung_NIO"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE][SIZE=2] wStatus = "NIO" [/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 Auswertung_IO"[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE][SIZE=2] wStatus = "IO" [/SIZE]
[SIZE=2][COLOR=#008000]' ------------------------------------------------------------------------------[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' Pointer auf Tabelle laden[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] appExcel = CreateObject ("EXCEL.Application")[/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] fs = CreateObject ("Scripting.FileSystemObject")[/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] fs.FileExists (Verzeichnis + Datei_Neu) [/SIZE][SIZE=2][COLOR=#0000ff]Then[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' ------------------------------------------------------------------------------[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' Datei ist schon angelegt - vorhandene benutzen ...[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' ------------------------------------------------------------------------------[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wbExcel = appExcel.Workbooks.Open (Verzeichnis + Datei_Neu)[/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wsExcel = wbExcel.Worksheets("Daten")[/SIZE]
[SIZE=2][COLOR=#008000]' Tabellen-Eckdaten ausfüllen[/COLOR][/SIZE]
[SIZE=2]Zeile = wsExcel.Range("H5") + 1 [/SIZE]
[SIZE=2][COLOR=#008000]' Zeilen-Daten eintragen[/COLOR][/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 1) = Now[/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 2) = wArtikel[/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 3) = wF1L1[/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 4) = wF2L2 [/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 5) = wHoehe [/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 6) = wAbw_max [/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 7) = wAbw_min[/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 8) = wStatus[/SIZE]
[SIZE=2][COLOR=#008000]' Tabelle abspeichern[/COLOR][/SIZE]
[SIZE=2]wsExcel.Range("H5") = Zeile [/SIZE]
[SIZE=2][COLOR=#008000]' wbExcel.Save ,true[/COLOR][/SIZE]
[SIZE=2]wbExcel.Close [/SIZE][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][SIZE=2][COLOR=#008000]'false[/COLOR][/SIZE]
[SIZE=2]appExcel.Quit ()[/SIZE]
[SIZE=2][COLOR=#0000ff]Else[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' ------------------------------------------------------------------------------[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' Datei ist noch nicht angelegt - Muster-Datei als Grundlage verwenden ...[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' ------------------------------------------------------------------------------[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wbExcel = appExcel.Workbooks.Open (Verzeichnis + Datei_Org)[/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wsExcel = wbExcel.Worksheets("Daten")[/SIZE]
[SIZE=2][COLOR=#008000]' Tabellen-Eckdaten ausfüllen[/COLOR][/SIZE]
[SIZE=2]wbExcel.Author = "Anlage 170"[/SIZE]
[SIZE=2]wsExcel.Range("B5") = Now [/SIZE]
[SIZE=2]Zeile = 11 [/SIZE]
[SIZE=2][COLOR=#008000]' Zeilen-Daten eintragen[/COLOR][/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 1) = Now[/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 2) = wArtikel[/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 3) = wF1L1[/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 4) = wF2L2 [/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 5) = wHoehe [/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 6) = wAbw_max [/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 7) = wAbw_min[/SIZE]
[SIZE=2]wsExcel.Cells (Zeile , 8) = wStatus[/SIZE]
[SIZE=2][COLOR=#008000]' Tabelle abspeichern[/COLOR][/SIZE]
[SIZE=2]wsExcel.Range("H5") = Zeile [/SIZE]
[SIZE=2]wbExcel.Saveas Verzeichnis + Datei_Neu ,[/SIZE][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE]
[SIZE=2]wbExcel.Close [/SIZE][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE]
[SIZE=2]appExcel.Quit ()[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' ------------------------------------------------------------------------------[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' verwendeten Speicher wieder freigeben[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wsExcel = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wbExcel = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] fs = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] appExcel = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wArtikel = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wF1L1 = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wF2L2 = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wHoehe = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wAbw_min = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wAbw_max = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] wStatus = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] Verzeichnis = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] Datei_Org = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] Datei_Neu = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Set[/COLOR][/SIZE][SIZE=2] Zeile = [/SIZE][SIZE=2][COLOR=#0000ff]Nothing[/COLOR][/SIZE]
[SIZE=2][COLOR=#ff0000]PtVar[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#ff0000]"St.211 Produktions-Daten vorhanden"[/COLOR][/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#0000ff]false[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE]