ich würde gerne eine Excel Datei einlesen, die zuvor auch mit COMatePlus erstellt wurde und weiteren Text einfügen
Beispiel:
- Ich habe die Datei test.xls. Diese möchte ich öffnen.
- Jetzt soll herausgefunden werden in welcher Zeile die letzten Wörter stehen. (Die Datei sieht aus wie eine art Aufgabenliste)
- zwei Zeilen unter diesem "letzten Text" möchte ich nun weiteren Text einfügen.
- Nun soll die Datei wieder gespeichert werden.
Ich möchte also eine Excel Datei immer weiter mit Text erweitern.
Gibt es Ideen, wie man das anstellen könnte?
Hier mein bisheriger Code:
Code: Alles auswählen
XIncludeFile "COMatePLUS.pbi"
IncludeFile "ExcelConstants.pbi"
date$ = FormatDate("%dd/%mm/%yyyy", Date())
Define.COMateObject ExcelObject, WorkBook
ExcelObject = COMate_CreateObject("Excel.Application")
If ExcelObject
If ExcelObject\SetProperty("Visible = #True") = #S_OK
WorkBook = ExcelObject\GetObjectProperty("Workbooks\Add")
If WorkBook
ExcelObject\SetProperty("Cells(1,1) = 'Datum:'")
ExcelObject\SetProperty("Cells(1,2) = '" + date$ + "' AS DATE")
ExcelObject\SetProperty("Cells(3,1) = 'Aufgabe:'")
ExcelObject\SetProperty("Application\DisplayAlerts = #False")
FFormat=#xlNormal
Workbook\Invoke("SaveAs('" + Excel_Temp$ + "'," + Str(FFormat) + ")")
ExcelObject\SetProperty("Application\DisplayAlerts = #False")
WorkBook\Release()
EndIf
EndIf
ExcelObject\Release()
Else
MessageRequester("Excel Datei erstellen", "Couldn't create the application object!")
EndIf