COMateObject frage!
Verfasst: 03.08.2010 19:18
Hallo Leute
Ich habe das Problem das bei diesem Code immer hinterher die Frage kommt ob ich speichern möchte.
Mich Fragt Excel immer ob ich speichern will nach dem ich die Daten aus der Tabelle geholt habe.
Kann man das abstellen?
alex
Ich habe das Problem das bei diesem Code immer hinterher die Frage kommt ob ich speichern möchte.
Code: Alles auswählen
OpenConsole()
ConsoleTitle ("Konsole")
EnableGraphicalConsole(1)
XIncludeFile "comateplus.pbi"
Define ExcelObject.COMateObject
Define Wert1.s, Wert2.s,Wert3.s, Wert4.s,Datum.s,Datensatz.s
ExcelObject = COMate_CreateObject("Excel.Application")
ExcelFile.s = "lagerbestand.xls"
If ExcelObject
If ExcelObject\Invoke("Workbooks\Open('" + ExcelFile + "')") = #S_OK
ExcelObject\Invoke("Workbooks(1)\Sheets(1)\Activate")
i = 4
Repeat
Wert1 = ExcelObject\GetStringProperty("Cells("+Str(i)+",1)")
Wert2 = ExcelObject\GetStringProperty("Cells("+Str(i)+",2)")
Wert3 = ExcelObject\GetStringProperty("Cells("+Str(i)+",3)")
Wert4 = ExcelObject\GetStringProperty("Cells("+Str(i)+",4)")
Datum = ExcelObject\GetStringProperty("Cells(3,3)")
If Wert1 = ""
Break
EndIf
Datensatz = Wert1+";"+Wert2+";"+Wert3+";"+Wert4+";"+Datum
PrintN(Datensatz)
Debug Datensatz
i = i+1
Until Wert1 = ""
Else
Debug "!Workbooks\Open"
Debug COMate_GetLastErrorDescription()
EndIf
ExcelObject\Invoke("Quit()")
ExcelObject\Release()
Else
Debug "!COMate_CreateObject"
Debug COMate_GetLastErrorDescription()
EndIf
CloseConsole()
Kann man das abstellen?
alex