hello,
I came across a example program of Siemens to write and read out/in excel but when i try to write script allways opens a new excel file and asks me to save it.
Can someone tell me how to prevent this?
The file in which the script is pointing does excist in that specific map
Probably it is in this part of the script
'Excel speichern und beenden
//XL_BW.ActiveWorkbook.Close(true)
Is there someone who knows how i can just write to it without allways have to "save as" it?
this is the script
'Variable, der Excel-Tabelle zugewiesen wird (Excel-Beispielwerte)
Dim XL_BW
'Zuweisung Excel-Applikation
Set XL_BW = CreateObject("excel.application")
'vorhandene Tabelle öffnen
XL_BW.workbooks.open "C:\Werkmap\Recepten PC\Voorbeeld plc programma\bsp_rezeptur.xls"
'Tabellen-Einträge (Zeile, Spalte)
XL_BW.cells(row,1).value = Now
XL_BW.cells(row,2).value = VAR1_INT
XL_BW.cells(row,3).value = VAR2_REAL
XL_BW.cells(row,4).value = VAR3_STRING
'Erhöht den Zeilenindex, um beim nächsten Aufruf in die Folgezeile zu schreiben
row = row + 1
'Tabelle nicht anzeigen
XL_BW.visible = false
'Excel speichern und beenden
XL_BW.ActiveWorkbook.Close(true)
'Verwendeten Speicher wieder freigeben
'Used storage will be freed
Set XL_BW = Nothing
Thx
I came across a example program of Siemens to write and read out/in excel but when i try to write script allways opens a new excel file and asks me to save it.
Can someone tell me how to prevent this?
The file in which the script is pointing does excist in that specific map
Probably it is in this part of the script
'Excel speichern und beenden
//XL_BW.ActiveWorkbook.Close(true)
Is there someone who knows how i can just write to it without allways have to "save as" it?
this is the script
'Variable, der Excel-Tabelle zugewiesen wird (Excel-Beispielwerte)
Dim XL_BW
'Zuweisung Excel-Applikation
Set XL_BW = CreateObject("excel.application")
'vorhandene Tabelle öffnen
XL_BW.workbooks.open "C:\Werkmap\Recepten PC\Voorbeeld plc programma\bsp_rezeptur.xls"
'Tabellen-Einträge (Zeile, Spalte)
XL_BW.cells(row,1).value = Now
XL_BW.cells(row,2).value = VAR1_INT
XL_BW.cells(row,3).value = VAR2_REAL
XL_BW.cells(row,4).value = VAR3_STRING
'Erhöht den Zeilenindex, um beim nächsten Aufruf in die Folgezeile zu schreiben
row = row + 1
'Tabelle nicht anzeigen
XL_BW.visible = false
'Excel speichern und beenden
XL_BW.ActiveWorkbook.Close(true)
'Verwendeten Speicher wieder freigeben
'Used storage will be freed
Set XL_BW = Nothing
Thx